View Source ProcessHub.Service.Synchronizer (ProcessHub v0.6.0)
The synchronizer service provides API functions for synchronizing process registry data between nodes.
Summary
Functions
Appends remote data to the local process registry.
Broadcasts local registry data to the specified target nodes.
Returns {:ok, data} to broadcast, or :suppress.
Detaches remote data from the local process registry.
Returns local node's process registry data used for synchronization.
Helper function to trigger interval synchronization.
Functions
@spec append_data(ProcessHub.Hub.t(), %{ required(node()) => [ {ProcessHub.child_spec(), pid(), ProcessHub.child_metadata()} ] }) :: :ok
Appends remote data to the local process registry.
@spec broadcast_local_registry(ProcessHub.Hub.t(), [node()]) :: :ok
Broadcasts local registry data to the specified target nodes.
Called when new nodes join the cluster to share local process information.
@spec broadcastable_local_data(ProcessHub.Hub.t()) :: {:ok, [{ProcessHub.child_spec(), pid(), ProcessHub.child_metadata()}]} | :suppress
Returns {:ok, data} to broadcast, or :suppress.
A node that has hosted no local child since boot returns an empty
local_sync_data/1; broadcasting it would make peers' detach_data/2 treat
the node as authoritatively empty and wipe its records. We suppress that empty
until the node has hosted a child at least once (latched in storage.misc,
which resets on restart). A node that legitimately drained its children is
already latched, so it still broadcasts its empty and peers reconcile.
@spec detach_data(ProcessHub.Hub.t(), %{ required(node()) => [{ProcessHub.child_spec(), pid()}] }) :: :ok
Detaches remote data from the local process registry.
@spec local_sync_data(ProcessHub.Hub.t()) :: [ {ProcessHub.child_spec(), pid(), ProcessHub.child_metadata()} ]
Returns local node's process registry data used for synchronization.
Helper function to trigger interval synchronization.
The system will use the configured synchronization strategy.