flash

package module
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLogger

func SetLogger(log *logs.Logger)

SetLogger - sets custom logrus logger

Types

type Concurrent

type Concurrent struct {
	// contains filtered or unexported fields
}

Concurrent is an executor for concurrent executions

func NewConcurrent

func NewConcurrent(ctx context.Context, engine *engine.Engine, completionBlock bool, opts ...ConcurrentOption) *Concurrent

NewConcurrent - initializes concurrent executor; if completionBlock=true, it will block main routine until all tasks completed

func (*Concurrent) Add

func (e *Concurrent) Add(executable Executable)

Add - adds an executable to the executables list

func (*Concurrent) Execute

func (c *Concurrent) Execute() error

Execute - executes all executables concurrently

func (*Concurrent) IsCompleted

func (e *Concurrent) IsCompleted() bool

IsCompleted - returns completion status

func (*Concurrent) OnFailure

func (c *Concurrent) OnFailure(err error)

OnFailure - handles failure callback

func (*Concurrent) OnSuccess

func (c *Concurrent) OnSuccess()

OnSuccess - handles completion callback

type ConcurrentOption added in v0.2.1

type ConcurrentOption func(*Concurrent)

func ConcurrentFailHandler added in v0.2.1

func ConcurrentFailHandler(fail func(err error)) ConcurrentOption

ConcurrentFailHandler - inits fail handler

func ConcurrentSuccessHandler added in v0.2.1

func ConcurrentSuccessHandler(success func()) ConcurrentOption

ConcurrentSuccessHandler - inits success handler

type Executable

type Executable interface {
	Execute() error
	IsCompleted() bool
	OnSuccess()
	OnFailure(err error)
}

Executable - interface for executables

type Parallel

type Parallel struct {
	// contains filtered or unexported fields
}

Parallel is an executor for parallel executions

func NewParallel

func NewParallel(ctx context.Context, opts ...ParallelOption) *Parallel

NewParallel - initializes a parallel executor

func (*Parallel) Add

func (e *Parallel) Add(executable Executable)

Add - adds an executable to the executables list

func (*Parallel) Execute

func (p *Parallel) Execute() error

Execute - executes all executables In parallel

func (*Parallel) IsCompleted

func (e *Parallel) IsCompleted() bool

IsCompleted - returns completion status

func (*Parallel) OnFailure

func (p *Parallel) OnFailure(err error)

OnFailure - handles failure callback

func (*Parallel) OnSuccess

func (p *Parallel) OnSuccess()

OnSuccess - handles completion callback

type ParallelOption added in v0.2.1

type ParallelOption func(parallel *Parallel)

func ParallelFailHandler added in v0.2.1

func ParallelFailHandler(fail func(err error)) ParallelOption

ParallelFailHandler - inits fail handler

func ParallelSuccessHandler added in v0.2.1

func ParallelSuccessHandler(success func()) ParallelOption

ParallelSuccessHandler - inits success handler

type Sequence

type Sequence struct {
	// contains filtered or unexported fields
}

Sequence is an executor for sequential executions

func NewSequence

func NewSequence(ctx context.Context, opts ...SequenceOption) *Sequence

NewSequence - initializes a sequence executor

func (*Sequence) Add

func (e *Sequence) Add(executable Executable)

Add - adds an executable to the executables list

func (*Sequence) Execute

func (s *Sequence) Execute() error

Execute - executes all executables sequentially

func (*Sequence) IsCompleted

func (e *Sequence) IsCompleted() bool

IsCompleted - returns completion status

func (*Sequence) OnFailure

func (s *Sequence) OnFailure(err error)

OnFailure - handles failure callback

func (*Sequence) OnSuccess

func (s *Sequence) OnSuccess()

OnSuccess - handles completion callback

type SequenceOption added in v0.2.1

type SequenceOption func(*Sequence)

func SequenceFailHandler added in v0.2.1

func SequenceFailHandler(fail func(err error)) SequenceOption

SequenceFailHandler - inits fail handler

func SequenceSuccessHandler added in v0.2.1

func SequenceSuccessHandler(success func()) SequenceOption

SequenceSuccessHandler - inits success handler

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL