View Source ProcessHub.Strategy.Distribution.Base protocol (ProcessHub v0.3.2-alpha)
The distribution strategy protocol defines behaviour to identify the nodes which are responsible for a child process.
Summary
Functions
Returns the list of nodes where the child process belongs to.
Perform any necessary initialization and validation for the started children.
Triggered when coordinator is initialized.
Types
@type t() :: term()
All the types that implement this protocol.
Functions
@spec belongs_to( strategy :: struct(), hub_id :: ProcessHub.hub_id(), child_id :: atom() | binary(), replication_factor :: pos_integer() ) :: [node()]
Returns the list of nodes where the child process belongs to.
The list of nodes is used to determine where the child process should be started or migrated to.
@spec children_init(struct(), ProcessHub.hub_id(), [map()], keyword()) :: :ok | {:error, any()}
Perform any necessary initialization and validation for the started children.
@spec init( struct(), ProcessHub.hub_id() ) :: any()
Triggered when coordinator is initialized.
Could be used to perform initialization.