Maps SuperCache partitions to Raft server groups.
Each partition gets one Raft cluster named after the partition. The voting
members are the partition's primary and replicas from
SuperCache.Cluster.Manager, so all nodes sharing a partition map derive
the same membership. The primary node creates the group; replica nodes host
their server and wait for it to become available.
Summary
Functions
Return the cluster name for a partition.
Return {to_add, to_remove} between current and desired member ids.
Ensure this node has a started group for a partition.
Return the partition indexes this node currently owns.
Return the state machine tuple for a partition.
Return all server ids for a partition, in deterministic
{name, node} order derived from the partition map.
Derive deterministic member ids from a {primary, replicas} tuple.
Return the local Raft server name for a partition.
Return this node's server id for a partition.
Start the Raft group for a partition.
Start groups for every partition owned by this node.
Stop the local Raft server for a partition.
Stop every local group started by this node.
Return the partition indexes with a local group started.
Forget all tracked groups without stopping their servers.
Functions
@spec cluster_name(non_neg_integer()) :: atom()
Return the cluster name for a partition.
Return {to_add, to_remove} between current and desired member ids.
@spec ensure_started(non_neg_integer()) :: :ok | {:error, term()}
Ensure this node has a started group for a partition.
@spec local_partitions() :: [non_neg_integer()]
Return the partition indexes this node currently owns.
@spec machine(non_neg_integer()) :: tuple()
Return the state machine tuple for a partition.
@spec member_ids(non_neg_integer()) :: [{atom(), node()}]
Return all server ids for a partition, in deterministic
{name, node} order derived from the partition map.
@spec members_from( {node(), [node()]}, non_neg_integer() ) :: [{atom(), node()}]
Derive deterministic member ids from a {primary, replicas} tuple.
@spec name(non_neg_integer()) :: atom()
Return the local Raft server name for a partition.
@spec server_id(non_neg_integer()) :: {atom(), node()}
Return this node's server id for a partition.
@spec start(non_neg_integer()) :: :ok | {:error, term()}
Start the Raft group for a partition.
@spec start_all() :: :ok
Start groups for every partition owned by this node.
@spec stop(non_neg_integer()) :: :ok | {:error, term()}
Stop the local Raft server for a partition.
@spec stop_all() :: :ok
Stop every local group started by this node.
@spec tracked() :: [non_neg_integer()]
Return the partition indexes with a local group started.
@spec untrack_all() :: :ok
Forget all tracked groups without stopping their servers.