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 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"`
Ticket string `json:"ticket,omitzero"`
Timers map[string]string `json:"timers,omitzero"` // the time of each, by its name
Entry []Send `json:"entry,omitzero"`
Exit []Send `json:"exit,omitzero"`
// On is where to go on each event, by its name: done, failed, a
// timer, a ticket's answer, or any other event.
On map[string][]Transition `json:"on,omitzero"`
// End is done or failed in a final state: how it ends the state that
// holds it, or the chart.
End string `json:"end,omitzero"`
Output any `json:"output,omitzero"`
}
State is one state in full form.
type Transition ¶
type Transition struct {
Go string `json:"go,omitzero"`
When string `json:"when,omitzero"`
Send []Send `json:"send,omitzero"`
}
Transition is one candidate of a rule.