Documentation
¶
Index ¶
- Constants
- type AsyncError
- type CallbackTypeOutOfRangeError
- type CanceledError
- type Ctx
- type DuplicateCallbackAfterEventError
- type DuplicateCallbackBeforeEventError
- type DuplicateCallbackEnterStateError
- type DuplicateCallbackError
- type DuplicateCallbackLeaveStateError
- type DuplicateTransitionError
- type Event
- type EventID
- type EventMap
- type EventOutOfRangeError
- type EventStartReserveError
- type EventStartReserveMissingError
- type Handler
- type InTransitionError
- type InternalError
- type InvalidEventError
- type NoTransitionError
- type NotInTransitionError
- type StateID
- type StateMap
- type StateOutOfRangeError
- type StateStartReserveError
- type StateStartReserveMissingError
- type TransDesc
- type UnknownEventError
Constants ¶
const ( UnknownStateStr = "unknownState" UnknownEventStr = "unknownEvent" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncError ¶
type AsyncError struct {
Err error
}
AsyncError is returned by FSM.Event() when a callback have initiated an asynchronous state transition.
func (AsyncError) Error ¶
func (e AsyncError) Error() string
type CallbackTypeOutOfRangeError ¶
type CallbackTypeOutOfRangeError struct {
Type int
}
func (CallbackTypeOutOfRangeError) Error ¶
func (e CallbackTypeOutOfRangeError) Error() string
type CanceledError ¶
type CanceledError struct {
Err error
}
CanceledError is returned by FSM.Event() when a callback have canceled a transition.
func (CanceledError) Error ¶
func (e CanceledError) Error() string
type Ctx ¶
type DuplicateCallbackAfterEventError ¶
type DuplicateCallbackAfterEventError struct {
// contains filtered or unexported fields
}
func (DuplicateCallbackAfterEventError) Error ¶
func (e DuplicateCallbackAfterEventError) Error() string
type DuplicateCallbackBeforeEventError ¶
type DuplicateCallbackBeforeEventError struct {
// contains filtered or unexported fields
}
func (DuplicateCallbackBeforeEventError) Error ¶
func (e DuplicateCallbackBeforeEventError) Error() string
type DuplicateCallbackEnterStateError ¶
type DuplicateCallbackEnterStateError struct {
// contains filtered or unexported fields
}
func (DuplicateCallbackEnterStateError) Error ¶
func (e DuplicateCallbackEnterStateError) Error() string
type DuplicateCallbackError ¶
type DuplicateCallbackError struct { }
func (DuplicateCallbackError) Error ¶
func (e DuplicateCallbackError) Error() string
type DuplicateCallbackLeaveStateError ¶
type DuplicateCallbackLeaveStateError struct {
// contains filtered or unexported fields
}
func (DuplicateCallbackLeaveStateError) Error ¶
func (e DuplicateCallbackLeaveStateError) Error() string
type DuplicateTransitionError ¶
type DuplicateTransitionError struct {
// contains filtered or unexported fields
}
func (DuplicateTransitionError) Error ¶
func (e DuplicateTransitionError) Error() string
type Event ¶
type Event struct { // EventID is id of this event. EventID // State is the state before the transition. Current StateID // Next is the state after the transition. Next StateID // Err is an optional error that can be used for capturing // any error inside event handler Err error // Args is a optinal list of arguments passed to the event handler. Args []interface{} }
Event is the info that gets passed as a reference to the Handler.
type EventOutOfRangeError ¶
type EventOutOfRangeError struct {
ID EventID
}
func (EventOutOfRangeError) Error ¶
func (e EventOutOfRangeError) Error() string
type EventStartReserveError ¶
type EventStartReserveError struct { }
func (EventStartReserveError) Error ¶
func (e EventStartReserveError) Error() string
type EventStartReserveMissingError ¶
type EventStartReserveMissingError struct { }
func (EventStartReserveMissingError) Error ¶
func (e EventStartReserveMissingError) Error() string
type Handler ¶
type Handler interface {
Handle(event *Event)
}
Handler is an interface that expects event Handle function. Event is the current event that is to be handled.
type InTransitionError ¶
type InTransitionError struct {
Event string
}
InTransitionError is returned by FSM.Event() when an asynchronous transition is already in progress.
func (InTransitionError) Error ¶
func (e InTransitionError) Error() string
type InternalError ¶
type InternalError struct{}
InternalError is returned by FSM.Event() and should never occur. It is a probably because of a bug.
func (InternalError) Error ¶
func (e InternalError) Error() string
type InvalidEventError ¶
InvalidEventError is returned by FSM.Event() when the event cannot be called in the current state.
func (InvalidEventError) Error ¶
func (e InvalidEventError) Error() string
type NoTransitionError ¶
type NoTransitionError struct {
Err error
}
NoTransitionError is returned by FSM.Event() when no transition have happened, for example if the source and destination states are the same.
func (NoTransitionError) Error ¶
func (e NoTransitionError) Error() string
type NotInTransitionError ¶
type NotInTransitionError struct{}
NotInTransitionError is returned by FSM.Transition() when an asynchronous transition is not in progress.
func (NotInTransitionError) Error ¶
func (e NotInTransitionError) Error() string
type StateOutOfRangeError ¶
type StateOutOfRangeError struct {
ID StateID
}
func (StateOutOfRangeError) Error ¶
func (e StateOutOfRangeError) Error() string
type StateStartReserveError ¶
type StateStartReserveError struct { }
func (StateStartReserveError) Error ¶
func (e StateStartReserveError) Error() string
type StateStartReserveMissingError ¶
type StateStartReserveMissingError struct { }
func (StateStartReserveMissingError) Error ¶
func (e StateStartReserveMissingError) Error() string
type TransDesc ¶
type TransDesc struct { // EventID is the id of the current event triggering this transition Event EventID // A slice of current states that the FSM must be in to perform a // state transition. CurrentStates []StateID // NextState state that the FSM has to jump upon successful transition NextState StateID //Event Handler Handler }
TransDesc describes a event transition
The event can have one or more current states that are valid for performing the transition. If the FSM is in one of the current states it will end up in the specified next state, invoking defined event handlers.
type UnknownEventError ¶
type UnknownEventError struct {
Event string
}
UnknownEventError is returned by FSM.Event() when the event is not defined.
func (UnknownEventError) Error ¶
func (e UnknownEventError) Error() string