Documentation
¶
Overview ¶
Package run defines metadata about transform script execution
Index ¶
Examples ¶
Constants ¶
const ( // RSWaiting indicates a script/step that has yet to start RSWaiting = Status("waiting") // RSRunning indicates a script/step is currently executing RSRunning = Status("running") // RSSucceeded indicates a script/step has completed without error RSSucceeded = Status("succeeded") // RSFailed indicates a script/step completed & exited when an unexpected error // occured RSFailed = Status("failed") // RSUnchanged indicates a script completed but no changes were found // since the last version of the script succeeded RSUnchanged = Status("unchanged") // RSSkipped indicates a script/step was not executed RSSkipped = Status("skipped") )
Variables ¶
This section is empty.
Functions ¶
func NewID ¶
func NewID() string
NewID creates a run identifier
Example ¶
myString := "SomeRandomStringThatIsLong-SoYouCanCallItAsMuchAsNeeded..." SetIDRand(strings.NewReader(myString)) a := NewID() SetIDRand(strings.NewReader(myString)) b := NewID() fmt.Printf("a: %s\nb: %s\neq: %t", a, b, a == b)
Output: a: 536f6d65-5261-4e64-af6d-537472696e67 b: 536f6d65-5261-4e64-af6d-537472696e67 eq: true
func SetIDRand ¶
SetIDRand sets the random reader that NewID uses as a source of random bytes passing in nil will default to crypto.Rand. This can be used to make ID generation deterministic for tests. eg:
myString := "SomeRandomStringThatIsLong-SoYouCanCallItAsMuchAsNeeded..." run.SetIDRand(strings.NewReader(myString)) a := NewID() run.SetIDRand(strings.NewReader(myString)) b := NewID()
Types ¶
type State ¶
type State struct { ID string `json:"id"` Number int `json:"number"` Status Status `json:"status"` Message string `json:"message"` StartTime *time.Time `json:"startTime"` StopTime *time.Time `json:"stopTime"` Duration int `json:"duration"` Steps []*StepState `json:"steps"` }
State is a passable, cachable data structure that describes the execution of a transform. State structs can act as a sink of transform events, collapsing the state transition of multiple transform events into a single structure
type Status ¶
type Status string
Status enumerates all possible execution states of a transform script or step within a script, in relation to the current time. Scripts & steps that have completed are broken into categories based on exit state
type StepState ¶
type StepState struct { Name string `json:"name"` Category string `json:"category"` Status Status `json:"status"` StartTime *time.Time `json:"startTime"` StopTime *time.Time `json:"stopTime"` Duration int `json:"duration"` Output []event.Event `json:"output"` }
StepState describes the execution of a transform step