package states
Import Path
/pkg/states (on go.dev)
Dependency Relation
imports 4 packages, and imported by 22 packages
Involved Source Files
Package states provides reusable state definitions.
- basic
- connected
- disposed
ss_connected.go
ss_disposed.go
states_utils.go
Package-Level Type Names (total 12)
BasicStatesDef contains all the basic states.
ErrHandlerTimeout indicates one of the state machine handlers has timed
out.
ErrNetwork indicates a generic network error.
Healthcheck is a periodic request making sure that the machine is still
alive.
Heartbeat is a periodic state that ensures the integrity of the machine.
Ready indicates the machine meets criteria to perform work.
Start indicates the machine should be working. Removing start can force
stop the machine.
StatesBase *am.StatesBase
Exception is the only built-in state and mean a global error. All errors
have to [State.Require] the Exception state. If [Machine.PanicToErr] is
true, Exception will receive it.
( BasicStatesDef) Names() machine.S
( BasicStatesDef) SetNames(names machine.S)
( BasicStatesDef) SetStateGroups(groups map[string][]int, order []string)
( BasicStatesDef) StateGroups() (map[string][]int, []string)
BasicStatesDef : github.com/pancsta/asyncmachine-go/pkg/machine.States
var BasicStates
ConnectedGroupsDef contains all the state groups of the Connected state
schema.
Connected S
var ConnectedGroups
type ConnectedState = string (basic type)
ConnectedStatesDef contains states for a connection status.
Required states:
- Start
Connected ConnectedState
Connecting ConnectedState
Disconnected ConnectedState
Disconnecting ConnectedState
ErrConnecting is a detailed connection error, eg no access.
StatesBase *am.StatesBase
Exception is the only built-in state and mean a global error. All errors
have to [State.Require] the Exception state. If [Machine.PanicToErr] is
true, Exception will receive it.
( ConnectedStatesDef) Names() machine.S
( ConnectedStatesDef) SetNames(names machine.S)
( ConnectedStatesDef) SetStateGroups(groups map[string][]int, order []string)
( ConnectedStatesDef) StateGroups() (map[string][]int, []string)
ConnectedStatesDef : github.com/pancsta/asyncmachine-go/pkg/machine.States
var ConnectedStates
ConnPoolGroupsDef contains all the state groups of the ConnPool state schema.
Connected S
var ConnPoolGroups
type ConnPoolState = string (basic type)
ConnPoolStatesDef contains states for a connection status.
Required states:
- Start
Connected ConnPoolState
ConnectedFully ConnPoolState
Connecting ConnPoolState
Disconnected ConnPoolState
Disconnecting ConnPoolState
ErrConnecting is a detailed connection error, eg no access.
StatesBase *am.StatesBase
Exception is the only built-in state and mean a global error. All errors
have to [State.Require] the Exception state. If [Machine.PanicToErr] is
true, Exception will receive it.
( ConnPoolStatesDef) Names() machine.S
( ConnPoolStatesDef) SetNames(names machine.S)
( ConnPoolStatesDef) SetStateGroups(groups map[string][]int, order []string)
( ConnPoolStatesDef) StateGroups() (map[string][]int, []string)
ConnPoolStatesDef : github.com/pancsta/asyncmachine-go/pkg/machine.States
var ConnPoolStates
DisposedGroupsDef contains all the state groups Disposed state machine.
Disposed S
var DisposedGroups
DisposedHandlers is a list of handler for pkg/states.DisposedStates
(*DisposedHandlers) DisposedState(e *am.Event)
(*DisposedHandlers) DisposingState(e *am.Event)
(*DisposedHandlers) RegisterDisposalEnter(e *am.Event) bool
(*DisposedHandlers) RegisterDisposalState(e *am.Event)
DisposedStatesDef contains all the states of the Disposed state machine.
One a machine implements this state mixing, it HAS TO be disposed using the
Disposing state (instead of [am.Machine.Dispose]).
Required states:
- Start
Disposed indicates that the machine has disposed allocated resources
and is ready to be garbage collected by calling [am.Machine.Dispose].
Disposing starts the machine disposal - first state-based and then calls
[am.Machine.Dispose].
RegisterDisposal registers a disposal handler passed under the
DisposedArgHandler key. Requires [DisposedHandlers] to be bound prior to
the registration. Handlers registered via RegisterDisposal can block.
StatesBase *am.StatesBase
Exception is the only built-in state and mean a global error. All errors
have to [State.Require] the Exception state. If [Machine.PanicToErr] is
true, Exception will receive it.
( DisposedStatesDef) Names() machine.S
( DisposedStatesDef) SetNames(names machine.S)
( DisposedStatesDef) SetStateGroups(groups map[string][]int, order []string)
( DisposedStatesDef) StateGroups() (map[string][]int, []string)
DisposedStatesDef : github.com/pancsta/asyncmachine-go/pkg/machine.States
var DisposedStates
S is a type alias for a list of state names.
State is a type alias for a state definition. See [am.State].
Package-Level Functions (only one)
AddErrConnecting wraps an error in the ErrConnecting sentinel and adds to a
machine.
Package-Level Variables (total 19)
var BasicSchema machine.Schema
BasicStates contains all the states for the Basic machine.
ConnectedGroups contains all the state groups for the Connected state
schema.
ConnectedSchema represents all relations and properties of ConnectedStates.
ConnectedStates contains all the states for the Connected state schema.
ConnPoolGroups contains all the state groups for the ConnPool state schema.
ConnPoolSchema represents all relations and properties of ConnPoolStates.
ConnPoolStates contains all the states for the ConnPool state schema.
DisposedArgHandler is the key for the disposal handler passed to the
RegisterDisposal state. It needs to contain the EXPLICIT type of
am.HandlerDispose, eg
var dispose am.HandlerDispose = func(id string, ctx *am.StateCtx) {
// ...
}
DisposedGroups contains all the state groups for the Disposed machine.
DisposedSchema represents all relations and properties of DisposedStates.
DisposedStates contains all the states for the Disposed machine.
var ErrConnecting error
Exception is a type alias for the exception state.
SAdd is a func alias for merging lists of states.
SchemaMerge is a func alias for extending an existing state structure.
StateAdd is a func alias for adding to an existing state definition.
StateSet is a func alias for replacing parts of an existing state
definition.
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |