sequence

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

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

func (seq *Sequence) Execute() error

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

func (seq *Sequence) ExecuteNext() error

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

func (seq *Sequence) HandleStepResults(stepResults []FnResult)

func (*Sequence) NextStep

func (seq *Sequence) NextStep() *Step

NextStep returns the first un-complete step, nil if the sequence is over.

func (*Sequence) StepsJSON

func (seq *Sequence) StepsJSON() ([]byte, error)

StepsJSON returns the JSON of the steps it is working on.

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.

Jump to

Keyboard shortcuts

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