View Source Siblings.Worker behaviour (Siblings v0.11.0)
The worker for the single sibling process.
Link to this section Summary
Types
Value, returned from on_call/2
callback
Identifier of the worker process
Message to be sent to the worker process
Payload associated with the worker
Callbacks
The Finitomata
FSM implementation module.
The handler for the routed message from
Siblings.InternalWorker.handle_call({:message, any()})
.
The function to re-initialize FSM after crash.
The callback to be implemented in each and every worker.
Link to this section Types
@type call_result() :: any()
Value, returned from on_call/2
callback
@type id() :: any()
Identifier of the worker process
@type message() :: any()
Message to be sent to the worker process
@type payload() :: Finitomata.State.payload()
Payload associated with the worker
Link to this section Callbacks
@callback fsm() :: module()
The Finitomata
FSM implementation module.
It will be used internally to carry the state of FSM. If not implemented, this module itself will be considered an FSM implementation.
@callback on_call(message :: message(), Siblings.InternalWorker.State.t()) :: {result :: call_result(), Siblings.InternalWorker.State.t()}
The handler for the routed message from
Siblings.InternalWorker.handle_call({:message, any()})
.
@callback on_init(pid()) :: :ok
The function to re-initialize FSM after crash.
@callback perform( state :: Finitomata.Transition.state(), id :: id(), payload :: payload() ) :: {:transition, Finitomata.Transition.event(), Finitomata.event_payload()} | {:reschedule, non_neg_integer()} | :noop
The callback to be implemented in each and every worker.
It will be called internally continiously by the internal worker process, transitioning the underlying FSM according to the return value.