pub struct MetadataConsensus { /* private fields */ }Expand description
Metadata consensus using Raft for authoritative state.
Wraps raft-style log replication for service registry and process
table consensus. When the cluster feature is active, this can
be backed by ruvector_raft::RaftNode; otherwise a self-contained
state machine is used.
Implementations§
Source§impl MetadataConsensus
impl MetadataConsensus
Sourcepub fn role(&self) -> ConsensusRole
pub fn role(&self) -> ConsensusRole
Current role.
Sourcepub fn commit_index(&self) -> u64
pub fn commit_index(&self) -> u64
Committed log index.
Sourcepub fn set_role(&mut self, role: ConsensusRole)
pub fn set_role(&mut self, role: ConsensusRole)
Transition to a new role.
Sourcepub fn advance_term(&mut self, new_term: u64)
pub fn advance_term(&mut self, new_term: u64)
Advance to a new term (resets vote state).
Sourcepub fn append(&mut self, operation: ConsensusOp) -> u64
pub fn append(&mut self, operation: ConsensusOp) -> u64
Append an entry to the log. Returns the index of the newly appended entry.
Sourcepub fn commit(&mut self, up_to: u64) -> Vec<&ConsensusEntry>
pub fn commit(&mut self, up_to: u64) -> Vec<&ConsensusEntry>
Commit entries up to the given index. Returns the newly committed entries.
Sourcepub fn entries(&self) -> &[ConsensusEntry]
pub fn entries(&self) -> &[ConsensusEntry]
Get all entries in the log.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MetadataConsensus
impl RefUnwindSafe for MetadataConsensus
impl Send for MetadataConsensus
impl Sync for MetadataConsensus
impl Unpin for MetadataConsensus
impl UnsafeUnpin for MetadataConsensus
impl UnwindSafe for MetadataConsensus
Blanket Implementations§
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 more