Skip to main content

Crate atomr_cluster

Crate atomr_cluster 

Source
Expand description

atomr-cluster.

Contains membership, gossip, reachability, heartbeat, and the split-brain resolver strategies.

Structs§

ClusterDaemonHandle
Public handle to a running ClusterDaemon.
ClusterEventBus
In-process cluster events bus.
ClusterRemoteAdapter
CrossDcSettings
Slow-path settings used for cross-DC heartbeats / gossip.
DaemonConfig
Configuration knobs.
DaemonSnapshot
Snapshot of the daemon state used by peer_state queries.
DownAllStrategy
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
GossipOverview
Snapshot of seen-by + unreachable info.
HeartbeatSender
In-memory heartbeat-sender state.
HeartbeatState
InProcessClusterTransport
Channel-backed cluster transport. Discovers peers through a shared InProcessRegistry. Construct one per node, register the daemon’s gossip inbox + a RemoteMessageSink via Self::start, and call Self::send_remote to push remote-tells.
InProcessRegistry
Shared registry that wires up InProcessClusterTransport siblings 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.
KeepMajorityStrategy
KeepMajority: the side with strictly more up members survives.
KeepOldestStrategy
KeepOldest: the side containing the oldest (lowest up_number) up member survives.
KeepReferee
KeepReferee: the side containing the designated referee member survives.
LeaderHandover
Watcher that detects leader transitions across successive MembershipState snapshots. Stateful: holds the previous snapshot’s leader and emits a LeaderHandoverEvent only on change.
LeaderHandoverEvent
Handover event emitted by a LeaderHandover watcher when the elected leader changes between snapshots. Cluster.LeaderChanged event published on the cluster’s domain event stream.
LeaseMajorityStrategy
LeaseMajority: majority decision gated by an external lease. In-memory simulation of whether a lease was acquired.
Member
MembershipState
NoSbr
Marker DowningStrategy used when no SBR runtime is installed.
PeerHeartbeat
Per-peer heartbeat record kept by the sender.
Reachability
RecordingSink
Test-only sink that buffers every received RemoteTell for later inspection. Public so binding-side tests can use it.
RemoteTellRecord
SbrRuntime
Runtime that pairs a strategy with a stability deadline.
SplitBrainResolver
Facade that holds any of the strategies behind a trait object.
StaticQuorumStrategy
StaticQuorum: requires at least quorum_size reachable members to survive.
SubscriptionHandle
RAII handle returned by ClusterEventBus::subscribe. Dropping it removes the corresponding subscriber.
TcpClusterTransport
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.
VectorClock

Enums§

ClusterEvent
Event variants published on ClusterEventBus.
ClusterFrame
Wire-level frame used by both InProcessClusterTransport and TcpClusterTransport. The two variants are multiplexed over the same connection so that gossip and Python-level remote-tells share the same association.
DaemonCmd
Control commands accepted by the daemon mailbox.
DowningDecision
What the resolver recommends the cluster do with the given side.
GossipDecision
Decision the receiver makes after comparing version vectors.
GossipPdu
One gossip exchange. Sender hands a GossipStatus to the peer; peer responds with either a full GossipEnvelope (if it has newer state) or a GossipMerge request (if its state is older).
MemberStatus
ReachabilityStatus
SbrAction
Action emitted by SbrRuntime::tick.
VectorRelation

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§

DowningStrategy
GossipTransport
Pluggable transport for gossip PDUs.
RemoteMessageSink
Sink for inbound RemoteTell frames. The pycore binding implements this — typically by decoding the payload via the codec registry and invoking tell on 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 peer from the perspective of local: in-DC peers get local_interval, cross-DC peers get cross.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 → Up while a partition is in flight).
member_dc
Extract the data-center name from a member’s role list. Returns DEFAULT_DC when no dc-* role is set.
next_status
Compute the next status for a member given the current convergence state. Returns None if no transition applies.
partition_by_dc
Partition a peer list into (in_dc, cross_dc) from local’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
true if a and b belong 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_daemon but installs an SBR runtime.