View Source ProcessHub.Strategy.Redundancy.Base protocol (ProcessHub v0.3.2-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

Types

t()

All the types that implement this protocol.

Functions

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

@spec init(
  struct(),
  ProcessHub.hub_id()
) :: any()

Triggered when coordinator is initialized.

Could be used to perform initialization.

Link to this function

master_node(strategy, hub_id, child_id, child_nodes)

View Source
@spec master_node(struct(), ProcessHub.hub_id(), ProcessHub.child_id(), [node()]) ::
  node()

Returns the master node that the given child_id belongs to.

Link to this function

replication_factor(strategy)

View Source
@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.