RaftEx.Leaderboard
(raft_ex v0.1.0)
View Source
In-memory leaderboard for tracking Raft cluster leaders across nodes.
Provides a lightweight ETS-based registry that records which node is the current leader for each Raft cluster. Useful for client-side request routing so that commands can be sent directly to the leader.
Summary
Functions
Clear the leaderboard entry for a cluster.
Initialize the leaderboard ETS table. Idempotent.
Find the local server ID for a given cluster.
Look up the current leader for a cluster.
Look up cluster members.
Get the last recorded timestamp for a cluster.
Return all known leaderboard entries.
Record the current leader and members for a cluster.
Functions
@spec clear(term()) :: :ok
Clear the leaderboard entry for a cluster.
Initialize the leaderboard ETS table. Idempotent.
@spec local_server_id(term()) :: RaftEx.Types.server_id() | nil
Find the local server ID for a given cluster.
This is useful for routing requests to the local Raft server process.
@spec lookup_leader(term()) :: RaftEx.Types.server_id() | nil
Look up the current leader for a cluster.
@spec lookup_members(term()) :: [RaftEx.Types.server_id()] | nil
Look up cluster members.
@spec lookup_timestamp(term()) :: DateTime.t() | nil
Get the last recorded timestamp for a cluster.
@spec overview() :: list()
Return all known leaderboard entries.
@spec record(term(), RaftEx.Types.server_id(), [RaftEx.Types.server_id()]) :: :ok
Record the current leader and members for a cluster.