Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
Chain is a set of Runners that will be executed sequentially
func NewChain ¶
NewChain creates a new chain. retries dictates how many times a Runner should be retried on error. retrySleep is how long to sleep before retrying a failed Runner
func (*Chain) AppendRunner ¶
AppendRunner appends a Runner to the Chain
func (*Chain) ErrorRollback ¶
ErrorRollback returns the last error returned by a Runner
func (*Chain) GetRunnerOutput ¶
GetRunnerOutput returns the output from a Runner. It is valid to pass *Chain to a Runner. The Runner can then use *Chain.GetRunnerOutput(...) to reference the output of Runners that executed before them.
type Runner ¶
type Runner interface {
// Name is used for logging and locating the output of a previously run Runner
Name() string
// Run does the work and returns a value. If error is returned the chain fails (after retries)
Run() (interface{}, error)
// Rollback is used to undo whatever Run() did
Rollback() error
}
Runner describes a struct that can be run and rolled back