View Source Siblings.Lookup (Siblings v0.11.3)

The instance of FSM backed up by Finitomata.

fsm-representation

FSM representation

graph TD
    idle --> |initialize| ready
    ready --> |start_child| ready
    ready --> |delete_child| ready
    ready --> |terminate| terminated

Link to this section Summary

Types

Kind of event which might be send to initiate the transition.

Functions

Getter for the internal compiled in FSM information.

Returns all the workers running under this Siblings instance as a map %{Siblings.Worker.id() => pid()}.

Returns a specification to start this module under a supervisor.

The convenient macro to allow using states in guards, returns a compile-time list of states for Siblings.Lookup.

Removes the reference for the naturally terminated child from the workers map through :delete_child transition with all the respective callbacks.

Returns the pid of the single dynamically supervised worker by its id.

Initiates the :start_child transition with all the respective callbacks to add a new child to the supervised list.

Starts an FSM alone with name and payload given.

Link to this section Types

@type state() :: :terminated | :ready | :idle | :*

Kind of event which might be send to initiate the transition.

fsm-representation

FSM representation

graph TD
    idle --> |initialize| ready
    ready --> |start_child| ready
    ready --> |delete_child| ready
    ready --> |terminate| terminated

Link to this section Functions

@spec __config__(atom()) :: any()

Getter for the internal compiled in FSM information.

Link to this function

all(name \\ Siblings.default_fqn())

View Source
@spec all(module()) :: %{required(Siblings.Worker.id()) => pid()}

Returns all the workers running under this Siblings instance as a map %{Siblings.Worker.id() => pid()}.

This map might be really huge when there are many processes managed.

Returns a specification to start this module under a supervisor.

See Supervisor.

The convenient macro to allow using states in guards, returns a compile-time list of states for Siblings.Lookup.

Link to this function

del(name \\ Siblings.default_fqn(), id)

View Source
@spec del(module(), Siblings.Worker.id()) :: :ok

Removes the reference for the naturally terminated child from the workers map through :delete_child transition with all the respective callbacks.

Link to this function

get(name \\ Siblings.default_fqn(), id, default \\ nil)

View Source

Returns the pid of the single dynamically supervised worker by its id.

Link to this function

put(name \\ Siblings.default_fqn(), worker)

View Source
@spec put(module(), Siblings.worker()) :: :ok

Initiates the :start_child transition with all the respective callbacks to add a new child to the supervised list.

Starts an FSM alone with name and payload given.

Usually one does not want to call this directly, the most common way would be to start a Finitomata supervision tree or even better embed it into the existing supervision tree and start FSM with Finitomata.start_fsm/3 passing Siblings.Lookup as the first parameter.