Documentation
¶
Overview ¶
Package state is the statechart engine of ADR-0008 and ADR-0040: which named transition a command means, which transitions leave a state, and the chain of eventless transitions a commit follows after its recalculation, with its bound. It evaluates no guard itself: the store, which holds the document and the VM, reports whether each guard holds.
Index ¶
- Constants
- func Chain(cls *model.Class, from string, path []string, ...) (_ []string, ok bool)
- func From(t *model.Transition, state string) bool
- func Leaving(cls *model.Class, state string) []*model.Transition
- func Named(cls *model.Class, name string) *model.Transition
- func Names(cls *model.Class) []string
Constants ¶
const MaxEventless = 8
MaxEventless is the bound of eventless transitions one command may fire (ADR-0008); past it the commit is refused with too_many_transitions.
Variables ¶
This section is empty.
Functions ¶
func Chain ¶
func Chain(cls *model.Class, from string, path []string, fires func(t *model.Transition, from string) bool) (_ []string, ok bool)
Chain follows the eventless transitions from a state: at every step the first one in definition order that leaves the current state and whose guard holds, as fires reports it, until none does. The states entered are appended to path, which the caller gives with the states visited so far. ok is false when more than MaxEventless fired; path then ends at the bound. The loop allocates nothing beyond the growth of path.
func From ¶
func From(t *model.Transition, state string) bool
From reports whether the transition leaves the state.
func Leaving ¶
func Leaving(cls *model.Class, state string) []*model.Transition
Leaving lists the named transitions whose sources include the state, in definition order: what Transitions and Preview list (ADR-0040).
Types ¶
This section is empty.