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

Types

t()

All the types that implement this protocol.

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

Link to this function

belongs_to(strategy, hub_id, child_id, replication_factor)

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

Link to this function

children_init(strategy, hub_id, child_specs, opts)

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