Documentation
¶
Index ¶
Constants ¶
const ( StatusNew = transitions.StatusNew StatusBooting = transitions.StatusBooting StatusRunning = transitions.StatusRunning StatusReloading = transitions.StatusReloading StatusStopping = transitions.StatusStopping StatusStopped = transitions.StatusStopped StatusError = transitions.StatusError StatusUnknown = transitions.StatusUnknown )
Variables ¶
var TypicalTransitions = transitions.Typical
TypicalTransitions is a set of standard transitions for a finite state machine.
Functions ¶
This section is empty.
Types ¶
type Machine ¶
type Machine struct {
*fsm.Machine
// contains filtered or unexported fields
}
Machine is a wrapper around go-fsm v2 that provides the v1 API compatibility. It manages both the FSM and broadcast functionality.
func New ¶
New creates a new finite state machine with the specified logger using "standard" state transitions. This function provides compatibility with the v1 API while using v2 under the hood.
func (*Machine) GetStateChan ¶
GetStateChan returns a channel that emits the state whenever it changes. The channel is closed when the provided context is canceled. For v1 API compatibility, the current state is sent immediately to the channel. A 5-second broadcast timeout is used to prevent slow consumers from blocking state updates.