Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Planner ¶
TODO: This probably should be returning an int indicating partial event processing
(or something like errPartial(nEvents))
returns func(ctx Context, st <T>) (func(*<T>), error), where <T> is the typeOf(User) param
type StateGroup ¶
type StateGroup struct {
// contains filtered or unexported fields
}
StateGroup manages a group of state machines sharing the same logic
func New ¶
func New(ds datastore.Datastore, hnd StateHandler, stateType interface{}) *StateGroup
stateType: T - (MyStateStruct{})
func (*StateGroup) Get ¶
func (s *StateGroup) Get(id interface{}) *statestore.StoredState
Get gets state for a single state machine
func (*StateGroup) List ¶
func (s *StateGroup) List(out interface{}) error
List outputs states of all state machines in this group out: *[]StateT
func (*StateGroup) Send ¶
func (s *StateGroup) Send(id interface{}, evt interface{}) (err error)
Send sends an event to machine identified by `id`. `evt` is going to be passed into StateHandler.Planner, in the events[].User param
If a state machine with the specified id doesn't exits, it's created, and it's state is set to zero-value of stateType provided in group constructor
type StateHandler ¶
type StateMachine ¶
type StateMachine struct {
// contains filtered or unexported fields
}