Documentation ¶
Overview ¶
Package states provides reusable state definitions.
- basic - connected - disposed
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ConnectedStates contains all the states for the Connected state set. ConnectedStates = cs // ConnectedGroups contains all the state groups for the Connected state set. ConnectedGroups = cg )
var ( // DisposedStates contains all the states for the Disposed machine. DisposedStates = ssD // DisposedGroups contains all the state groups for the Disposed machine. DisposedGroups = sgD )
var (
// BasicStates contains all the states for the Basic machine.
BasicStates = ssB
)
var BasicStruct = am.Struct{ ssB.Exception: {Multi: true}, ssB.ErrNetwork: {Require: S{Exception}}, ssB.ErrHandlerTimeout: {Require: S{Exception}}, ssB.Start: {}, ssB.Ready: {Require: S{ssB.Start}}, ssB.Healthcheck: {Multi: true}, ssB.Heartbeat: {}, }
var ConnectedStruct = am.Struct{ cs.Connecting: { Require: S{ssB.Start}, Remove: cg.Connected, }, cs.Connected: { Require: S{ssB.Start}, Remove: cg.Connected, }, cs.Disconnecting: {Remove: cg.Connected}, cs.Disconnected: { Auto: true, Remove: cg.Connected, }, }
ConnectedStruct represents all relations and properties of ConnectedStates.
var DisposedArgHandler = "DisposedArgHandler"
var DisposedStruct = am.Struct{
ssD.RegisterDisposal: {},
ssD.Disposing: {Remove: sgD.Disposed},
ssD.Disposed: {Remove: sgD.Disposed},
}
DisposedStruct represents all relations and properties of DisposedStates.
var Exception = am.Exception
Exception is a type alias for the exception state.
var SAdd = am.SAdd
SAdd is a func alias for merging lists of states.
var StateAdd = am.StateAdd
StateAdd is a func alias for adding to an existing state definition.
var StateSet = am.StateSet
StateSet is a func alias for replacing parts of an existing state definition.
var StructMerge = am.StructMerge
StructMerge is a func alias for extending an existing state structure.
Functions ¶
This section is empty.
Types ¶
type BasicStatesDef ¶ added in v0.8.0
type BasicStatesDef struct { *am.StatesBase // ErrNetwork indicates a generic network error. ErrNetwork string // ErrHandlerTimeout indicates one of state machine handlers has timed out. ErrHandlerTimeout string // Start indicates the machine should be working. Removing start can force // stop the machine. Start string // Ready indicates the machine meets criteria to perform work. Ready string // Healthcheck is a periodic request making sure that the machine is still // alive. Healthcheck string // Heartbeat is a periodic state which ensures integrity of the machine. Heartbeat string }
BasicStatesDef contains all the basic states.
type ConnectedGroupsDef ¶ added in v0.8.0
type ConnectedGroupsDef struct {
Connected S
}
ConnectedGroupsDef contains all the state groups of the Connected state set.
type ConnectedStatesDef ¶ added in v0.8.0
type ConnectedStatesDef struct { Connecting string Connected string Disconnecting string Disconnected string *am.StatesBase }
ConnectedStatesDef contains states for a connection status.
type DisposedGroupsDef ¶ added in v0.10.0
type DisposedGroupsDef struct {
Disposed S
}
DisposedGroupsDef contains all the state groups Disposed state machine.
type DisposedHandlers ¶ added in v0.10.0
type DisposedHandlers struct { // DisposedHandlers is a list of handler for pkg/states.DisposedStates DisposedHandlers []am.HandlerDispose }
func (*DisposedHandlers) DisposingState ¶ added in v0.10.0
func (h *DisposedHandlers) DisposingState(e *am.Event)
func (*DisposedHandlers) RegisterDisposalEnter ¶ added in v0.10.0
func (h *DisposedHandlers) RegisterDisposalEnter(e *am.Event) bool
func (*DisposedHandlers) RegisterDisposalState ¶ added in v0.10.0
func (h *DisposedHandlers) RegisterDisposalState(e *am.Event)
type DisposedStatesDef ¶ added in v0.10.0
type DisposedStatesDef struct { *am.StatesBase // RegisterDisposal registers a disposal handler passed under the // DisposedArgHandler key. RegisterDisposal string // Disposing indicates that the machine is during the disposal process. Disposing string // Disposed indicates that the machine has disposed allocated resoruces // and is ready to be garbage collected by calling [am.Machine.Dispose]. Disposed string }
DisposedStatesDef contains all the states of the Disposed state machine.