Documentation
¶
Overview ¶
Package stepfunctions emulates AWS Step Functions over JSON 1.0: state machines, activities and an ASL interpreter that runs each execution in the background (Lambda and service integrations, callbacks, Retry/Catch, Parallel, Map, intrinsics) and records its full history.
Index ¶
- Variables
- type Activity
- type Alias
- type Catcher
- type Def
- type Execution
- type Machine
- type Retrier
- type Service
- func (s *Service) Close() error
- func (s *Service) History(executionArn string) []map[string]any
- func (s *Service) Info() core.Info
- func (s *Service) Inspect(table, id string) any
- func (s *Service) Load(b []byte) error
- func (s *Service) Reset()
- func (s *Service) Resources() []core.Table
- func (s *Service) Save() ([]byte, error)
- func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Service) StartConsole(account, region, smArn, input string) (string, error)
- type State
- type Version
Constants ¶
This section is empty.
Variables ¶
var MaxWait = 60 * time.Second
MaxWait caps every real sleep (Wait states and Retry backoff) so local runs never stall. This is on purpose, a known difference from AWS (a Wait of 3600 seconds ends after 60), listed in docs/reference/coverage.yaml. Do not remove it without the owner's say-so.
var RetrySpeedup = 1.0
RetrySpeedup divides Retry intervals: 10 makes retries ten times faster than on AWS.
Functions ¶
This section is empty.
Types ¶
type Activity ¶
type Activity struct {
ARN string `json:"arn"`
Name string `json:"name"`
Account string `json:"account"`
Region string `json:"region"`
Created time.Time `json:"created"`
Tags map[string]string `json:"tags,omitempty"`
}
Activity is a task queue served by external workers.
type Alias ¶
type Alias struct {
ARN string `json:"arn"`
Name string `json:"name"`
MachineARN string `json:"machineArn"`
Description string `json:"description,omitempty"`
Routes []route `json:"routes"`
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
}
Alias points at one or two versions of a state machine.
type Catcher ¶
type Catcher struct {
ErrorEquals []string
ResultPath jpath
Next string
Output, Assign any // Output is JSONata only
}
Catcher is one Catch entry.
type Def ¶
type Def struct {
StartAt string
States map[string]*State
TimeoutSeconds int
QueryLanguage string
// contains filtered or unexported fields
}
Def is a state machine, a Parallel branch or a Map item processor.
type Execution ¶
type Execution struct {
ARN string `json:"arn"`
Name string `json:"name"`
MachineARN string `json:"machineArn"`
Account string `json:"account"`
Region string `json:"region"`
Definition string `json:"definition"` // as of the start
RoleArn string `json:"roleArn"`
Updated time.Time `json:"updated"` // machine update date as of the start
VersionARN string `json:"versionArn,omitempty"` // when started through a version or an alias
AliasARN string `json:"aliasArn,omitempty"`
Status string `json:"status"`
Input string `json:"input"`
Output string `json:"output,omitempty"`
Error string `json:"error,omitempty"`
Cause string `json:"cause,omitempty"`
Start time.Time `json:"start"`
Stop time.Time `json:"stop,omitzero"`
Events []map[string]any `json:"events"`
// contains filtered or unexported fields
}
Execution is one run of a state machine with its history.
type Machine ¶
type Machine struct {
ARN string `json:"arn"`
Name string `json:"name"`
Account string `json:"account"`
Region string `json:"region"`
Type string `json:"type"`
Definition string `json:"definition"`
RoleArn string `json:"roleArn"`
Logging json.RawMessage `json:"logging,omitempty"`
Tracing json.RawMessage `json:"tracing,omitempty"`
Revision string `json:"revision"`
LastVersion int `json:"lastVersion,omitempty"` // the newest version number; numbers are not reused
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
Tags map[string]string `json:"tags,omitempty"`
}
Machine is a state machine.
type Retrier ¶
type Retrier struct {
ErrorEquals []string
IntervalSeconds *float64
MaxAttempts *int
BackoffRate *float64
MaxDelaySeconds float64
}
Retrier is one Retry entry.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the Step Functions emulator.
func (*Service) Inspect ¶
Inspect shows a state machine with its recent executions, or an execution with its history.
type State ¶
type State struct {
Type, Next, Default, Resource string
End bool
QueryLanguage string
InputPath, OutputPath, ResultPath, ItemsPath jpath
Parameters, ResultSelector, ItemSelector any
Arguments, Output, Items any // JSONata states
Assign, ItemReader any
Result json.RawMessage
TimeoutSeconds, HeartbeatSeconds, Seconds num
TimeoutSecondsPath string
Retry []Retrier
Catch []Catcher
Choices []map[string]any
SecondsPath, Timestamp, TimestampPath string
Error, Cause, ErrorPath, CausePath string
Branches []*Def
Iterator, ItemProcessor *Def
MaxConcurrency num
MaxConcurrencyPath string
ToleratedFailureCount num // Map: checked, not applied (a failed item still fails the Map)
ToleratedFailurePercentage num
ToleratedFailureCountPath string
ToleratedFailurePercentagePath string
// contains filtered or unexported fields
}
State is one ASL state; the fields its type does not use stay zero.
type Version ¶
type Version struct {
ARN string `json:"arn"`
MachineARN string `json:"machineArn"`
Number int `json:"number"`
Description string `json:"description,omitempty"`
Type string `json:"type"`
Definition string `json:"definition"`
RoleArn string `json:"roleArn"`
Logging json.RawMessage `json:"logging,omitempty"`
Tracing json.RawMessage `json:"tracing,omitempty"`
Revision string `json:"revision"`
Created time.Time `json:"created"`
}
Version is a published copy of a state machine.