Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is a helper struct used for constructing StateMachines.
func (*Builder) Build ¶
func (b *Builder) Build(ctx context.Context, gcsClient gcs.GCSClient, gsPath string) (*StateMachine, error)
Build and return a StateMachine instance.
func (*Builder) F ¶
func (b *Builder) F(name string, fn TransitionFn)
Add a transition function with the given name. Allows nil functions for no-op transitions.
type StateMachine ¶
type StateMachine struct {
// contains filtered or unexported fields
}
StateMachine is a simple state machine implementation which persists its current state to a file.
func (*StateMachine) GetTransitionName ¶
func (sm *StateMachine) GetTransitionName(dest string) (string, error)
Return the name of the transition function from the current state to the given state.
func (*StateMachine) ListStates ¶
func (sm *StateMachine) ListStates() []string
ListStates returns the list of all states in the StateMachine.
func (*StateMachine) Transition ¶
func (sm *StateMachine) Transition(ctx context.Context, dest string) error
Attempt to transition to the given state, using the transition function.
type TransitionFn ¶
TransitionFn is a function to run when attempting to transition from one State to another. It is okay to give nil as a noop TransitionFn.