View Source ProcessHub.Strategy.Synchronization.Base protocol (ProcessHub v0.5.0-beta)

This protocol defines the behavior of a synchronization strategy.

Summary

Types

t()

All the types that implement this protocol.

Functions

Broadcasts local registry data to target nodes when they join the cluster. Called after nodes are added to the cluster state.

Handles received node join data and stores it in the local registry. Called when another node broadcasts its registry data to us.

Handles the periodic synchronization of the process registry.

Triggered when coordinator is initialized.

Initializes the periodic synchronization of the process registry.

Propagates requests to other nodes in the cluster.

Types

@type t() :: term()

All the types that implement this protocol.

Functions

Link to this function

broadcast_local_data(strategy, hub, local_data, target_nodes)

View Source
@spec broadcast_local_data(
  t(),
  ProcessHub.Hub.t(),
  [{ProcessHub.child_spec(), pid(), ProcessHub.child_metadata()}],
  [node()]
) :: :ok

Broadcasts local registry data to target nodes when they join the cluster. Called after nodes are added to the cluster state.

Link to this function

handle_node_join_data(strategy, hub, remote_data, remote_node)

View Source
@spec handle_node_join_data(t(), ProcessHub.Hub.t(), term(), node()) :: :ok

Handles received node join data and stores it in the local registry. Called when another node broadcasts its registry data to us.

Link to this function

handle_synchronization(strategy, hub, remote_data, remote_node)

View Source
@spec handle_synchronization(t(), ProcessHub.Hub.t(), term(), node()) :: :ok

Handles the periodic synchronization of the process registry.

@spec init(
  struct(),
  ProcessHub.Hub.t()
) :: struct()

Triggered when coordinator is initialized.

Could be used to perform initialization.

Link to this function

init_sync(strategy, hub, cluster_nodes)

View Source
@spec init_sync(t(), ProcessHub.Hub.t(), [node()]) :: :ok

Initializes the periodic synchronization of the process registry.

Link to this function

propagate(strategy, hub, requests, opts)

View Source
@spec propagate(
  t(),
  ProcessHub.Hub.t(),
  [ProcessHub.Request.CrossNodeRequest.t()],
  keyword()
) :: :ok

Propagates requests to other nodes in the cluster.