pub struct SingleNodeControlPlane { /* private fields */ }Expand description
A minimal single-node control-plane engine: this node is the sole voter and therefore the leader of term 1. It exists to (a) give the first cut a usable implementation of the boundary, and (b) make the leader-only-append and no-user-data invariants executable tests rather than prose.
It is intentionally not the replicated engine — that is a later slice.
What matters is that the later engine swaps in behind ControlPlaneConsensus
without touching callers.
Implementations§
Source§impl SingleNodeControlPlane
impl SingleNodeControlPlane
Sourcepub fn bootstrap_leader(identity: ClusterVoterIdentity) -> Self
pub fn bootstrap_leader(identity: ClusterVoterIdentity) -> Self
A single-node control plane that has elected identity as the leader of
term 1, voting for itself. This is the trivial-but-correct quorum: a
one-member majority.
Sourcepub fn entries(&self) -> &[ControlPlaneEntry]
pub fn entries(&self) -> &[ControlPlaneEntry]
The entries committed so far, in log order.
Trait Implementations§
Source§impl ControlPlaneConsensus for SingleNodeControlPlane
impl ControlPlaneConsensus for SingleNodeControlPlane
Source§fn current_term(&self) -> ControlPlaneTerm
fn current_term(&self) -> ControlPlaneTerm
The current Supervisor election term.
Source§fn leader(&self) -> Option<ClusterVoterIdentity>
fn leader(&self) -> Option<ClusterVoterIdentity>
The current Supervisor leader, if one is elected for
current_term.Source§fn durable_vote(&self) -> DurableVoteState
fn durable_vote(&self) -> DurableVoteState
The durable per-node vote state, persisted before acknowledging a vote.
Source§fn commit_index(&self) -> Option<ControlPlaneIndex>
fn commit_index(&self) -> Option<ControlPlaneIndex>
The index of the highest committed entry, or
None if the log is empty.Source§fn append(
&mut self,
entry: ControlPlaneEntry,
) -> Result<ControlPlaneIndex, ControlPlaneError>
fn append( &mut self, entry: ControlPlaneEntry, ) -> Result<ControlPlaneIndex, ControlPlaneError>
Append a control-plane entry as the leader. Read more
Auto Trait Implementations§
impl Freeze for SingleNodeControlPlane
impl RefUnwindSafe for SingleNodeControlPlane
impl Send for SingleNodeControlPlane
impl Sync for SingleNodeControlPlane
impl Unpin for SingleNodeControlPlane
impl UnsafeUnpin for SingleNodeControlPlane
impl UnwindSafe for SingleNodeControlPlane
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request