View Source ProcessHub.Strategy.Redundancy.Base protocol (ProcessHub v0.2.0-alpha)
The redundancy protocol relies on the HashRing
library to distribute processes across
the cluster and determine which node should be responsible for a given process by its child_id
key.
It is possible to start the same process on multiple nodes in the cluster.
Summary
Functions
This function is called when ProcessHub.DistributedSupervisor
has started a new
child process, and the strategy can perform any post-start actions.
This function is called when ProcessHub.DistributedSupervisor
has started a
replica of a child process, and the strategy can perform any post-update actions.
Triggered when coordinator is initialized.
Returns the master node that the given child_id
belongs to.
Returns the replication factor for the given strategy struct. This is the number of replicas that the process will be started with.
Types
@type t() :: term()
All the types that implement this protocol.
Functions
handle_post_start(strategy, hub_id, child_id, child_pid, child_nodes)
View Source@spec handle_post_start(struct(), ProcessHub.hub_id(), ProcessHub.child_id(), pid(), [ node() ]) :: :ok
This function is called when ProcessHub.DistributedSupervisor
has started a new
child process, and the strategy can perform any post-start actions.
handle_post_update(strategy, hub_id, child_id, hub_nodes, action_node, opts)
View Source@spec handle_post_update( struct(), ProcessHub.hub_id(), ProcessHub.child_id(), [node()], {:up | :down, node()}, keyword() ) :: :ok
This function is called when ProcessHub.DistributedSupervisor
has started a
replica of a child process, and the strategy can perform any post-update actions.
@spec init( struct(), ProcessHub.hub_id() ) :: any()
Triggered when coordinator is initialized.
Could be used to perform initialization.
@spec master_node(struct(), ProcessHub.hub_id(), ProcessHub.child_id(), [node()]) :: node()
Returns the master node that the given child_id
belongs to.
@spec replication_factor(struct()) :: pos_integer()
Returns the replication factor for the given strategy struct. This is the number of replicas that the process will be started with.