Documentation
¶
Overview ¶
Engine tasks: - let drivers register actions - parse scenario .dot files - execute scenarios
Index ¶
- Constants
- Variables
- func IsNotResolved(x interface{}) bool
- type Arg
- type ArgApplier
- type CalculationFunc
- type Doer
- type Engine
- func (e *Engine) CheckAction(action string) (ok bool, doer Doer)
- func (e *Engine) Exec(ctx context.Context, d Doer) error
- func (e *Engine) ExecList(ctx context.Context, tag string, list []string) []error
- func (e *Engine) ExecPart(ctx context.Context, d Doer) error
- func (e *Engine) List() []string
- func (e *Engine) ParseText(tag, text string) (Doer, error)
- func (e *Engine) Register(action string, d Doer)
- func (e *Engine) RegisterNewFunc(name string, fun func(context.Context) error)
- func (e *Engine) RegisterNewFuncAgr(name string, fun func(ctx context.Context, arg Arg) error)
- func (e *Engine) RegisterNewSeq(name string, ds ...Doer)
- func (e *Engine) RegisterParse(name, scenario string) error
- func (e *Engine) Resolve(action string) Doer
- func (e *Engine) ResolveOrLazy(action string) (Doer, error)
- func (e *Engine) SetProfile(re *regexp.Regexp, min time.Duration, fun ProfileFunc)
- func (e *Engine) TestDo(t testing.TB, ctx context.Context, name string)
- func (e *Engine) ValidateExec(ctx context.Context, d Doer) error
- type ErrNotResolved
- type ErrorActionEntry
- type Fail
- type Forcer
- type Func
- type Func0
- type FuncArg
- func (fa FuncArg) AddErrorAction(code string, d Doer, skipMain bool)
- func (fa FuncArg) Apply(a Arg) (Doer, bool, error)
- func (fa FuncArg) Calculation() float64
- func (fa FuncArg) Do(ctx context.Context) error
- func (fa FuncArg) FixErrorAction(code string) Doer
- func (fa FuncArg) String() string
- func (fa FuncArg) Validate() error
- type IgnoreArg
- type Lazy
- func (l *Lazy) AddErrorAction(code string, d Doer, skipMain bool)
- func (l *Lazy) Calculation() float64
- func (l *Lazy) Do(ctx context.Context) error
- func (l *Lazy) FixErrorAction(code string) Doer
- func (l *Lazy) Force() (d Doer, forced bool, err error)
- func (l *Lazy) String() string
- func (l *Lazy) Validate() error
- type MaybeBool
- type Nothing
- type ProfileFunc
- type RepeatN
- type RestartError
- type Seq
- func (seq *Seq) AddErrorAction(code string, d Doer, skipMain bool)
- func (seq *Seq) Append(d Doer) *Seq
- func (seq *Seq) Apply(arg Arg) (Doer, bool, error)
- func (seq *Seq) Calculation() (summ float64)
- func (seq *Seq) Do(ctx context.Context) error
- func (seq *Seq) FixErrorAction(errorCode string) Doer
- func (seq *Seq) Force() (Doer, bool, error)
- func (seq *Seq) String() string
- func (seq *Seq) Validate() (err error)
- type Sleep
- type ValidateFunc
Constants ¶
View Source
const ContextKey = "run/engine"
View Source
const FmtErrContext = "`%s`" // errors.Annotatef(err, FmtErrContext, doer.String())
Variables ¶
View Source
var ( ErrArgNotApplied = errors.Errorf("Argument is not applied") ErrArgOverwrite = errors.Errorf("Argument already applied") )
Functions ¶
func IsNotResolved ¶
func IsNotResolved(x interface{}) bool
IsNotResolved Test `error` or `Doer` against ErrNotResolved
Types ¶
type CalculationFunc ¶ added in v0.250114.0
type CalculationFunc func() float64
type Doer ¶
type Engine ¶
func (*Engine) CheckAction ¶ added in v0.260428.0
func (*Engine) RegisterNewFunc ¶
func (*Engine) RegisterNewFuncAgr ¶ added in v0.230424.2
func (*Engine) RegisterNewSeq ¶
func (*Engine) RegisterParse ¶
func (*Engine) SetProfile ¶
SetProfile re=nil or fun=nil to disable profiling.
type ErrNotResolved ¶
type ErrNotResolved struct {
// contains filtered or unexported fields
}
func NewErrNotResolved ¶
func NewErrNotResolved(action string) ErrNotResolved
func (ErrNotResolved) Error ¶
func (e ErrNotResolved) Error() string
type ErrorActionEntry ¶ added in v0.260428.0
type Func ¶
type Func struct {
Name string
F func(context.Context) error
ErrorF map[string]func(context.Context) error
V ValidateFunc
C CalculationFunc
}
func (Func) AddErrorAction ¶ added in v0.260428.0
func (Func) Calculation ¶ added in v0.250114.0
func (Func) FixErrorAction ¶ added in v0.260428.0
type Func0 ¶
type Func0 struct {
Name string
F func() error
ErrorF map[int32]func(context.Context) error
V ValidateFunc
C CalculationFunc
}
func (Func0) AddErrorAction ¶ added in v0.260428.0
func (Func0) Calculation ¶ added in v0.250114.0
func (Func0) FixErrorAction ¶ added in v0.260428.0
type FuncArg ¶
type FuncArg struct {
Name string
F func(context.Context, Arg) error
ErrorF map[string]Doer
V ValidateFunc
C CalculationFunc
// contains filtered or unexported fields
}
func (FuncArg) AddErrorAction ¶ added in v0.260428.0
func (FuncArg) Calculation ¶ added in v0.250114.0
func (FuncArg) FixErrorAction ¶ added in v0.260428.0
FixErrorAction implements Doer.
type Lazy ¶
type Lazy struct {
Name string
// ErrorF map[int32]func(context.Context) error
ErrorF map[string]Doer
// contains filtered or unexported fields
}
func (*Lazy) AddErrorAction ¶ added in v0.260428.0
AddErrorAction implements Doer.
func (*Lazy) Calculation ¶ added in v0.250114.0
func (*Lazy) FixErrorAction ¶ added in v0.260428.0
FixErrorAction implements Doer.
type Nothing ¶
type Nothing struct{ Name string }
func (Nothing) AddErrorAction ¶ added in v0.260428.0
func (Nothing) Calculation ¶ added in v0.250114.0
func (Nothing) FixErrorAction ¶ added in v0.260428.0
type ProfileFunc ¶
type RepeatN ¶
func (RepeatN) AddErrorAction ¶ added in v0.260428.0
func (RepeatN) Calculation ¶ added in v0.250114.0
func (RepeatN) FixErrorAction ¶ added in v0.260428.0
type RestartError ¶
func (*RestartError) Calculation ¶ added in v0.250114.0
func (re *RestartError) Calculation() float64
func (*RestartError) String ¶
func (re *RestartError) String() string
func (*RestartError) Validate ¶
func (re *RestartError) Validate() error
type Seq ¶
type Seq struct {
ErrorActions map[string]ErrorActionEntry
// contains filtered or unexported fields
}
Sequence executor. Specialized version of Tree for performance. Error in one action aborts whole group. Build graph with NewSeq().Append()
func (*Seq) AddErrorAction ¶ added in v0.260428.0
func (*Seq) Calculation ¶ added in v0.250114.0
func (*Seq) FixErrorAction ¶ added in v0.260428.0
FixErrorAction returns Doer for error string matching regex keys. If no Doer matches, returns nil. add action after fixing error
type Sleep ¶
func (Sleep) AddErrorAction ¶ added in v0.260428.0
func (Sleep) Calculation ¶ added in v0.250114.0
func (Sleep) FixErrorAction ¶ added in v0.260428.0
type ValidateFunc ¶
type ValidateFunc func() error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.