A GenServer that keeps the consistent hash ring in sync with the
current cluster topology for distributed Nebulex adapters.
The RingMonitor is started automatically as part of the partitioned cache supervision tree. It performs the following duties:
Cluster subscription - Subscribes to Erlang's
:pg(process groups) viaNebulex.Distributed.Cluster.monitor_scope/0to receive join and leave notifications for the cache's group.Ring synchronisation - When nodes join or leave the cluster, the RingMonitor adds or removes them from the
ExHashRing.Ring, ensuring key-to-node mappings stay up to date.Periodic rejoin - To handle race conditions during concurrent cluster startup (where some nodes may miss initial join events), the RingMonitor periodically rejoins the
:pggroup at the interval configured by:rejoin_interval(default: 30 seconds). Because:pgjoins are idempotent, this forces all nodes to refresh their ring view and guarantees eventual consistency.
Telemetry events
The RingMonitor emits Telemetry events under
telemetry_prefix ++ [:ring_monitor, event]. See the
"Adapter-specific telemetry events" section in
Nebulex.Adapters.Partitioned for the full list of events,
measurements, and metadata.
Summary
Functions
Returns a specification to start this module under a supervisor.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.