Skip to main content

ControlPlaneConsensus

Trait ControlPlaneConsensus 

Source
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§

Source

fn role(&self) -> ControlPlaneRole

This node’s current control-plane role.

Source

fn term(&self) -> u64

The current control-plane term.

Source

fn leader(&self) -> Option<String>

The member this node currently believes is leader, if any.

Source

fn committed_index(&self) -> u64

Highest control-plane log index known committed (durable to a quorum).

Source

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§

Source

fn is_leader(&self) -> bool

Whether this node is the current leader — the normal writer of ownership-catalog transitions (ADR 0052).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§