pub struct SharedConsensus<L, M, H> { /* private fields */ }
Expand description
Convenience wrapper for multithreaded handling of consensus packages
Based on standard Arc<Mutex<_>>
approach
Implementations§
pub fn new(consensus: HandledConsensus<L, M, H>) -> Self
Sourcepub fn apply_peer_message(
&self,
from: ServerId,
message: PeerMessage,
) -> Result<(), Error>
pub fn apply_peer_message( &self, from: ServerId, message: PeerMessage, ) -> Result<(), Error>
Applies a peer message to the consensus state machine.
Sourcepub fn apply_client_message(
&self,
from: ClientId,
message: ClientRequest,
) -> Result<(), Error>
pub fn apply_client_message( &self, from: ClientId, message: ClientRequest, ) -> Result<(), Error>
Applies a client message to the consensus state machine.
Sourcepub fn apply_timeout(&self, timeout: ConsensusTimeout) -> Result<(), Error>
pub fn apply_timeout(&self, timeout: ConsensusTimeout) -> Result<(), Error>
Triggers a timeout for the peer.
Sourcepub fn heartbeat_timeout(
&self,
peer: ServerId,
) -> Result<AppendEntriesRequest, Error>
pub fn heartbeat_timeout( &self, peer: ServerId, ) -> Result<AppendEntriesRequest, Error>
Triggers a heartbeat timeout for the peer.
pub fn election_timeout(&self) -> Result<(), Error>
Trait Implementations§
Source§fn clone(&self) -> SharedConsensus<L, M, H>
fn clone(&self) -> SharedConsensus<L, M, H>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
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