Documentation
¶
Overview ¶
Package statechart is the machine that is always in some state and moves between states when events arrive.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type After ¶
type After struct {
At string `json:"at"`
Rules []Transition `json:"rules"`
}
After is a rule taken at a time: a length of time from entry, or a time of day.
type Chart ¶
type Chart struct {
Initial string `json:"initial,omitzero"`
States map[string]*State `json:"states"`
}
Chart is the full form of a statechart's own part of a definition.
type Send ¶
type Send struct {
To string `json:"to"`
Event string `json:"event"`
Data any `json:"data,omitzero"`
}
Send is the chart's one action: a named event to the parent or a child.
type State ¶
type State struct {
Initial string `json:"initial,omitzero"`
States map[string]*State `json:"states,omitzero"`
Job *machine.JobSpec `json:"job,omitzero"`
Jobs map[string]*machine.JobSpec `json:"jobs,omitzero"`
Wait string `json:"wait,omitzero"`
Entry []Send `json:"entry,omitzero"`
Exit []Send `json:"exit,omitzero"`
Done []Transition `json:"done,omitzero"`
Failed []Transition `json:"failed,omitzero"`
On map[string][]Transition `json:"on,omitzero"`
After []After `json:"after,omitzero"`
Final bool `json:"final,omitzero"`
Fails bool `json:"fails,omitzero"` // a final state marked as a failure
Output any `json:"output,omitzero"`
}
State is one state in full form.
type Transition ¶
type Transition struct {
To string `json:"to,omitzero"`
When string `json:"when,omitzero"`
Send []Send `json:"send,omitzero"`
}
Transition is one candidate of a rule.