pub struct ConsensusManager { /* private fields */ }Expand description
Consensus algorithm implementation (simplified Raft)
Implementations§
Source§impl ConsensusManager
impl ConsensusManager
Sourcepub fn start_election(&mut self) -> Result<(), DistributedError>
pub fn start_election(&mut self) -> Result<(), DistributedError>
Start leader election
Sourcepub fn handle_vote_request(&mut self, request: VoteRequest) -> VoteResponse
pub fn handle_vote_request(&mut self, request: VoteRequest) -> VoteResponse
Handle vote request
Sourcepub fn append_entry(&mut self, entry: LogEntry) -> Result<(), DistributedError>
pub fn append_entry(&mut self, entry: LogEntry) -> Result<(), DistributedError>
Append log entry
Sourcepub fn get_state(&self) -> (ConsensusState, u64)
pub fn get_state(&self) -> (ConsensusState, u64)
Get current state
Auto Trait Implementations§
impl Freeze for ConsensusManager
impl RefUnwindSafe for ConsensusManager
impl Send for ConsensusManager
impl Sync for ConsensusManager
impl Unpin for ConsensusManager
impl UnwindSafe for ConsensusManager
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> 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