GenServer that orchestrates cluster role management.
This is the application / orchestration layer in Clean Architecture terms. It coordinates:
ClusterHelper.ETSStore— persists role↔node mappingsClusterHelper.Broadcast— cluster-wide event propagation via:pgClusterHelper.PullEngine— background sync with generation-based detectionClusterHelper.RemoteSync— RPC to remote nodesClusterHelper.EventHandler— user-defined callbacksClusterHelper.ClusterState— pure in-memory state
What changed (v0.7 → v0.8)
Previously, NodeConfig was a ~1000-line God module mixing ETS, :pg,
RPC, config, and business logic. It has been decomposed into focused
modules — each with a single responsibility — while keeping the same
GenServer client API for full backward compatibility.
Summary
Functions
Adds a single role to the local node and propagates cluster-wide.
Adds multiple roles to the local node and propagates cluster-wide.
Returns all nodes with at least one role. Reads directly from ETS.
Returns a specification to start this module under a supervisor.
Returns all roles for the local node. Reads directly from ETS.
Returns nodes with the given role. Reads directly from ETS.
Returns roles for a node. Reads directly from ETS.
Joins an additional scope.
Leaves a scope, removing all roles and cleaning up.
Lists all scopes the local node is participating in.
Returns true when the node is the local node.
Removes a single role from the local node and propagates cluster-wide.
Removes multiple roles from the local node and propagates cluster-wide.
Functions
Adds a single role to the local node and propagates cluster-wide.
Adds multiple roles to the local node and propagates cluster-wide.
Returns all nodes with at least one role. Reads directly from ETS.
Returns a specification to start this module under a supervisor.
See Supervisor.
Returns all roles for the local node. Reads directly from ETS.
Returns nodes with the given role. Reads directly from ETS.
Returns roles for a node. Reads directly from ETS.
@spec join_scope(atom()) :: :ok | {:error, :already_joined}
Joins an additional scope.
@spec leave_scope(atom()) :: :ok | {:error, :not_joined}
Leaves a scope, removing all roles and cleaning up.
@spec list_scopes() :: [atom()]
Lists all scopes the local node is participating in.
Returns true when the node is the local node.
Removes a single role from the local node and propagates cluster-wide.
Removes multiple roles from the local node and propagates cluster-wide.
@spec start_link(any()) :: GenServer.on_start()