View Source Finitomata.Supervisor behaviour (Finitomata v0.26.3)
THe behaviour for actual FSM implementations across Finitomata framework.
It ships with two predefined implementations, Finitomata
for local
applications and Infinitomata
for distributed ones.
Summary
Callbacks
Returns whether the FSM instance under id
“branch” and with fsm_name
name is alive
Returns all the active FSM instances under the id
“branch,” it might be a heavy map
The Finitomata
“branch” child specification, used from supervision trees to start supervised FSM “branchs”
Starts the new FSM instance under id
“branch,” the semantics is similar to DynamicSupervisor.start_child/2
Returns the state of the FSM instance under id
“branch” with fsm_name
name
Effectively initiates the on_timer/2
callback imminently, resetting the timer
Sends the event with an optional payload to the running FSM instance to initiate a transition
Functions
Returns a specification to start this module under a supervisor.
Types
@type t() :: module()
The module, implementing this behaviour
Callbacks
@callback alive?(id :: Finitomata.id(), fsm_name :: Finitomata.fsm_name()) :: boolean()
Returns whether the FSM instance under id
“branch” and with fsm_name
name is alive
@callback all(Finitomata.id()) :: %{ optional(Finitomata.fsm_name()) => %{ optional(:node) => node(), optional(:reference) => reference(), optional(:module) => Finitomata.implementation(), pid: pid() } }
Returns all the active FSM instances under the id
“branch,” it might be a heavy map
@callback child_spec(id :: Finitomata.id()) :: Supervisor.child_spec()
The Finitomata
“branch” child specification, used from supervision trees to start supervised FSM “branchs”
@callback start_fsm( id :: Finitomata.id(), fsm_name :: Finitomata.fsm_name(), implementation :: Finitomata.implementation(), payload :: Finitomata.payload() ) :: DynamicSupervisor.on_start_child()
Starts the new FSM instance under id
“branch,” the semantics is similar to DynamicSupervisor.start_child/2
@callback state( id :: Finitomata.id(), fsm_name :: Finitomata.fsm_name(), reload? :: :cached | :payload | :state | :full | (Finitomata.State.t() -> any()) ) :: nil | Finitomata.State.t() | Finitomata.State.payload() | any()
Returns the state of the FSM instance under id
“branch” with fsm_name
name
@callback timer_tick(id :: Finitomata.id(), fsm_name :: Finitomata.fsm_name()) :: :ok
Effectively initiates the on_timer/2
callback imminently, resetting the timer
@callback transition( id :: Finitomata.id(), fsm_name :: Finitomata.fsm_name(), event_payload :: Finitomata.Transition.event() | {Finitomata.Transition.event(), Finitomata.State.payload()}, delay :: non_neg_integer() ) :: :ok
Sends the event with an optional payload to the running FSM instance to initiate a transition
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.