Documentation
¶
Index ¶
- Variables
- type FnResult
- type Sequence
- func (seq *Sequence) ExecGroup(fns []executable.CallableFn) ([]FnResult, error)
- func (seq *Sequence) ExecSingleFn(fn executable.CallableFn) (*FnResult, error)
- func (seq *Sequence) Execute() error
- func (seq *Sequence) ExecuteNext() error
- func (seq *Sequence) HandleStepErrs(results []FnResult, step executable.Executable) error
- func (seq *Sequence) HandleStepResults(stepResults []FnResult)
- func (seq *Sequence) NextStep() *Step
- func (seq *Sequence) StepsJSON() ([]byte, error)
- type Step
Constants ¶
This section is empty.
Variables ¶
var ErrMissingFQFN = errors.New("callableFn missing FQFN")
Functions ¶
This section is empty.
Types ¶
type FnResult ¶
type FnResult struct {
FQFN string `json:"fqfn"`
Key string `json:"key"`
Response *request.CoordinatedResponse `json:"response"`
RunErr rt.RunErr `json:"runErr"` // runErr is an error returned from a Runnable.
ExecErr string `json:"execErr"` // err is an annoying workaround that allows runGroup to propogate non-RunErrs out of its loop. Should be refactored when possible.
}
type Sequence ¶
type Sequence struct {
// contains filtered or unexported fields
}
func FromJSON ¶
func FromJSON(seqJSON []byte, req *request.CoordinatedRequest, exec *executor.Executor, ctx *vk.Ctx) (*Sequence, error)
FromJSON creates a sequence from a JSON-encoded set of steps.
func New ¶
func New(execs []executable.Executable, req *request.CoordinatedRequest, exec *executor.Executor, ctx *vk.Ctx) (*Sequence, error)
New creates a new Sequence.
func (*Sequence) ExecGroup ¶
func (seq *Sequence) ExecGroup(fns []executable.CallableFn) ([]FnResult, error)
runGroup runs a group of functions this is all more complicated than it needs to be, Grav should be doing more of the work for us here.
func (*Sequence) ExecSingleFn ¶
func (seq *Sequence) ExecSingleFn(fn executable.CallableFn) (*FnResult, error)
func (*Sequence) Execute ¶
Execute returns the "final state" of a Sequence. If the state's err is not nil, it means a runnable returned an error, and the Directive indicates the Sequence should return. if exec itself actually returns an error other than ErrSequenceRunErr, it means there was a problem executing the Sequence as described, and should be treated as such.
func (*Sequence) ExecuteNext ¶
ExecuteNext executes the "next" step (i.e. the first un-completed step) in the sequence.
func (*Sequence) HandleStepErrs ¶
func (seq *Sequence) HandleStepErrs(results []FnResult, step executable.Executable) error
func (*Sequence) HandleStepResults ¶
type Step ¶
type Step struct {
Exec executable.Executable `json:"exec"`
Completed bool `json:"completed"`
}
Step is a container over Executable that includes a 'Completed' field.