pub trait ControlPlaneConsensus {
// Required methods
fn role(&self) -> ControlPlaneRole;
fn term(&self) -> u64;
fn leader(&self) -> Option<String>;
fn committed_index(&self) -> u64;
fn propose(
&mut self,
entry: ControlPlaneEntry,
) -> Result<u64, ProposeRefusal>;
// Provided method
fn is_leader(&self) -> bool { ... }
}Expand description
The Cluster Supervisor’s control-plane consensus seam.
A follow-up slice implements this over a concrete Raft-equivalent engine. Callers — the rebalancer, the join/drain flows, the ownership-transition machinery — depend on this trait and the ADR 0052 boundaries, never on the engine. The contract is intentionally narrow: read the current role/term/leader and committed index, and (leader-only) propose a control-plane entry.
Implementations must uphold ADR 0052’s safety properties: one leader per
term, committed entries never lost, no double-vote across restart, and the
data/control isolation that ControlPlaneEntry already enforces at the
type level.
Required Methods§
Sourcefn role(&self) -> ControlPlaneRole
fn role(&self) -> ControlPlaneRole
This node’s current control-plane role.
Sourcefn committed_index(&self) -> u64
fn committed_index(&self) -> u64
Highest control-plane log index known committed (durable to a quorum).
Sourcefn propose(&mut self, entry: ControlPlaneEntry) -> Result<u64, ProposeRefusal>
fn propose(&mut self, entry: ControlPlaneEntry) -> Result<u64, ProposeRefusal>
Append a control-plane entry to the replicated log.
Leader-only. Returns the index the entry will occupy once committed by a
quorum, or a ProposeRefusal if this node is not the leader or has
lost quorum. The returned index is assigned, not yet committed; callers
that need durability wait for committed_index
to reach it.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".