Expand description
atomr-cluster.
Contains membership, gossip, reachability, heartbeat, and the split-brain resolver strategies.
Structs§
- Cluster
Daemon Handle - Public handle to a running
ClusterDaemon. - Cluster
Event Bus - In-process cluster events bus.
- Cluster
Remote Adapter - Cross
DcSettings - Slow-path settings used for cross-DC heartbeats / gossip.
- Daemon
Config - Configuration knobs.
- Daemon
Snapshot - Snapshot of the daemon state used by
peer_statequeries. - Down
AllStrategy - DownAll: unconditionally downs every member on both sides of the partition. Used when the operator prefers cluster-wide restart over any chance of split-brain (matches “down-all-when-unstable” in related industry SBR catalogs).
- Gossip
- Gossip
Overview - Snapshot of seen-by + unreachable info.
- Heartbeat
Sender - In-memory heartbeat-sender state.
- Heartbeat
State - InProcess
Cluster Transport - Channel-backed cluster transport. Discovers peers through a shared
InProcessRegistry. Construct one per node, register the daemon’s gossip inbox + aRemoteMessageSinkviaSelf::start, and callSelf::send_remoteto push remote-tells. - InProcess
Registry - Shared registry that wires up
InProcessClusterTransportsiblings in the same process. A single registry is created once per “logical network” and handed to every transport that should be able to reach every other. - Keep
Majority Strategy - KeepMajority: the side with strictly more up members survives.
- Keep
Oldest Strategy - KeepOldest: the side containing the oldest (lowest
up_number) up member survives. - Keep
Referee - KeepReferee: the side containing the designated
refereemember survives. - Leader
Handover - Watcher that detects leader transitions across successive
MembershipStatesnapshots. Stateful: holds the previous snapshot’s leader and emits aLeaderHandoverEventonly on change. - Leader
Handover Event - Handover event emitted by a
LeaderHandoverwatcher when the elected leader changes between snapshots.Cluster.LeaderChangedevent published on the cluster’s domain event stream. - Lease
Majority Strategy - LeaseMajority: majority decision gated by an external lease. In-memory simulation of whether a lease was acquired.
- Member
- Membership
State - NoSbr
- Marker
DowningStrategyused when no SBR runtime is installed. - Peer
Heartbeat - Per-peer heartbeat record kept by the sender.
- Reachability
- Recording
Sink - Test-only sink that buffers every received
RemoteTellfor later inspection. Public so binding-side tests can use it. - Remote
Tell Record - SbrRuntime
- Runtime that pairs a strategy with a stability deadline.
- Split
Brain Resolver - Facade that holds any of the strategies behind a trait object.
- Static
Quorum Strategy - StaticQuorum: requires at least
quorum_sizereachable members to survive. - Subscription
Handle - RAII handle returned by
ClusterEventBus::subscribe. Dropping it removes the corresponding subscriber. - TcpCluster
Transport - TCP-based cluster transport. One listener per node accepts inbound
connections; outbound connections are opened on demand and reused
per peer address. Frames are length-prefixed (4-byte big-endian)
bincode-encoded
ClusterFrames. - Vector
Clock
Enums§
- Cluster
Event - Event variants published on
ClusterEventBus. - Cluster
Frame - Wire-level frame used by both
InProcessClusterTransportandTcpClusterTransport. The two variants are multiplexed over the same connection so that gossip and Python-level remote-tells share the same association. - Daemon
Cmd - Control commands accepted by the daemon mailbox.
- Downing
Decision - What the resolver recommends the cluster do with the given side.
- Gossip
Decision - Decision the receiver makes after comparing version vectors.
- Gossip
Pdu - One gossip exchange. Sender hands a
GossipStatusto the peer; peer responds with either a fullGossipEnvelope(if it has newer state) or aGossipMergerequest (if its state is older). - Member
Status - Reachability
Status - SbrAction
- Action emitted by
SbrRuntime::tick. - Vector
Relation
Constants§
- DC_
ROLE_ PREFIX - Convention: a member’s data-center is encoded as a role of the
form
"dc-<name>". uses the same prefix. - DEFAULT_
DC - Default DC name used when no
dc-*role is present.
Traits§
- Downing
Strategy - Gossip
Transport - Pluggable transport for gossip PDUs.
- Remote
Message Sink - Sink for inbound
RemoteTellframes. The pycore binding implements this — typically by decoding the payload via the codec registry and invokingtellon the matching local actor.
Functions§
- elect_
leader - Pick the deterministic leader from a
MembershipState. - gossip_
decide - Pure decision function: given the local + remote version vectors, what should we do?
- heartbeat_
interval_ for - Pick the heartbeat interval to use against
peerfrom the perspective oflocal: in-DC peers getlocal_interval, cross-DC peers getcross.heartbeat_interval. - is_
converged - Convergence holds when every member that this node believes is
alive is also reachable. gossip uses convergence as a
pre-condition for the leader’s status-transition tick (the
leader won’t move members from
Joining → Upwhile a partition is in flight). - member_
dc - Extract the data-center name from a member’s role list. Returns
DEFAULT_DCwhen nodc-*role is set. - next_
status - Compute the next status for a member given the current convergence
state. Returns
Noneif no transition applies. - partition_
by_ dc - Partition a peer list into
(in_dc, cross_dc)fromlocal’s perspective. - pick_
gossip_ target - Pick the next peer to gossip with, given a list of known peer
addresses and a per-tick cursor. Skips
self_addr. - same_dc
trueifaandbbelong to the same data-center.- spawn_
daemon - Spawn a daemon. The caller provides a transport implementation; the daemon never blocks on it.
- spawn_
daemon_ with_ sbr - Same as
spawn_daemonbut installs an SBR runtime.