ClusterHelper.ETSStore (ClusterHelper v1.0.1)

Copy Markdown View Source

ETS-based implementation of ClusterHelper.RoleStore.

Maintains two named ETS tables:

  • ClusterHelper.NodeConfig — a :bag table with {:scope, scope, :role, role} → node and {:scope, scope, :node, node} → role entries for bidirectional O(1) lookups
  • ClusterHelper.NodeConfig_nodes — a :set table with {:scope, scope, node} entries for O(1) node enumeration per scope

Read operations (get_my_roles/1, get_nodes/2, get_roles/2, all_nodes/1) bypass any GenServer and read directly from ETS with read_concurrency: true.

Table names

Table names are kept as ClusterHelper.NodeConfig and its derived name for backward compatibility with any code that references the ETS table directly.

Summary

Functions

Returns true if the node has any roles in the scope.

Purges all ETS entries for a scope.

Functions

has_roles?(node, scope)

@spec has_roles?(node(), atom()) :: boolean()

Returns true if the node has any roles in the scope.

purge_scope(scope)

@spec purge_scope(atom()) :: :ok

Purges all ETS entries for a scope.