Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FSM ¶
type FSM interface { // CurrentState returns the current state of the FSM CurrentState() State // InitialState sets the initial FSM state InitialState(st State) // Transition used to move from one state to another Transition(event Event, args ...interface{}) (interface{}, error) }
FSM represents endure finite state machine
type FSMImpl ¶
type FSMImpl struct {
// contains filtered or unexported fields
}
FSMImpl is endure FSM interface implementation
func NewFSM ¶
NewFSM returns new FSM implementation based on initial state and callbacks to move from one state to another
func (*FSMImpl) InitialState ¶
InitialState (see interface)
func (*FSMImpl) Transition ¶
Transition moves endure from one state to another Rules: Transition table: Event -> Init. Error on other events (Start, Stop) 1. Initializing -> Initialized Event -> Start. Error on other events (Initialize, Stop) 2. Starting -> Started Event -> Stop. Error on other events (Start, Initialize) 3. Stopping -> Stopped
Click to show internal directories.
Click to hide internal directories.