View Source ProcessHub.Strategy.Distribution.Base protocol (ProcessHub v0.2.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.
Triggered when children are started.
Trigger when coordinator process is shutting down.
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()}
Triggered when children are started.
Could be used to perform validation.
@spec handle_shutdown( struct(), ProcessHub.hub_id() ) :: any()
Trigger when coordinator process is shutting down.
@spec init( struct(), ProcessHub.hub_id() ) :: any()
Triggered when coordinator is initialized.
Could be used to perform initialization.