pub struct WitnessSupervisor<S>where
S: LastVoteStore,{ /* private fields */ }Expand description
A booted witness node: the control-plane supervisor with no data plane.
A witness is a Voter over a durable last-vote store plus the node’s
shared NodeIdentity — and nothing else. There is intentionally no
engine, no WAL, and no replication handle on this struct: a witness
cannot serve data because it holds none.
The store type is generic so production uses the durable
FileLastVoteStore (ADR 0030: “the supervisor needs durable per-node
vote state to prevent double-voting across restarts”) while tests use an
in-memory store.
Implementations§
Source§impl<S> WitnessSupervisor<S>where
S: LastVoteStore,
impl<S> WitnessSupervisor<S>where
S: LastVoteStore,
Sourcepub fn new(identity: NodeIdentity, store: S) -> WitnessSupervisor<S>
pub fn new(identity: NodeIdentity, store: S) -> WitnessSupervisor<S>
Boot a witness supervisor over store, identified by the shared
per-node identity. The voter id is the identity’s certificate
subject, so the witness votes under the same identity a data member
would replicate under.
Sourcepub fn profile(&self) -> RuntimeProfile
pub fn profile(&self) -> RuntimeProfile
A witness always runs the witness profile.
Sourcepub fn boots_data_plane(&self) -> bool
pub fn boots_data_plane(&self) -> bool
A witness never boots a data plane — invariant by construction, stated here so callers (and the boot pipeline) can assert it without reaching into the profile.
Sourcepub fn identity(&self) -> &NodeIdentity
pub fn identity(&self) -> &NodeIdentity
The shared per-node identity this witness authenticates with — the
same NodeIdentity type a data member
presents over mTLS.
Sourcepub fn member(&self) -> Member
pub fn member(&self) -> Member
This witness’s entry in the supervisor’s membership view: a vote-only
MemberKind::Witness, always VotingState::Voting.
It counts toward quorum but is never electable.
Sourcepub fn consider_vote(
&self,
req: &VoteRequest,
commit_watermark: u64,
) -> Result<VoteDecision, LastVoteError>
pub fn consider_vote( &self, req: &VoteRequest, commit_watermark: u64, ) -> Result<VoteDecision, LastVoteError>
Consider a candidate’s vote request against the current commit
watermark — the only control-plane action a witness performs. The
watermark rule and the durable double-vote guard live in the
Voter, so a witness applies the exact same safety rule a data
voter does.
Sourcepub fn current_term(&self) -> Result<u64, LastVoteError>
pub fn current_term(&self) -> Result<u64, LastVoteError>
The highest term this witness has durably recorded.
Source§impl WitnessSupervisor<FileLastVoteStore>
impl WitnessSupervisor<FileLastVoteStore>
Sourcepub fn with_durable_store(
identity: NodeIdentity,
last_vote_path: impl Into<PathBuf>,
) -> WitnessSupervisor<FileLastVoteStore>
pub fn with_durable_store( identity: NodeIdentity, last_vote_path: impl Into<PathBuf>, ) -> WitnessSupervisor<FileLastVoteStore>
Boot a witness with a durable, on-disk last-vote store at
last_vote_path — the production constructor. Survives a restart so a
witness that crashes mid-term never double-votes (ADR 0030).
Auto Trait Implementations§
impl<S> Freeze for WitnessSupervisor<S>where
S: Freeze,
impl<S> RefUnwindSafe for WitnessSupervisor<S>where
S: RefUnwindSafe,
impl<S> Send for WitnessSupervisor<S>where
S: Send,
impl<S> Sync for WitnessSupervisor<S>where
S: Sync,
impl<S> Unpin for WitnessSupervisor<S>where
S: Unpin,
impl<S> UnsafeUnpin for WitnessSupervisor<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for WitnessSupervisor<S>where
S: UnwindSafe,
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
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>
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>
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>
T in a tonic::Request