Struct raft_consensus::shared::SharedConsensus [−][src]
pub struct SharedConsensus<L, M, H> { /* fields omitted */ }
Convenience wrapper for multithreaded handling of consensus packages
Based on standard Arc<Mutex<_>>
approach
Methods
impl<L, M, H> SharedConsensus<L, M, H> where
L: Log,
M: StateMachine,
H: ConsensusHandler,
[src]
impl<L, M, H> SharedConsensus<L, M, H> where
L: Log,
M: StateMachine,
H: ConsensusHandler,
pub fn new(consensus: HandledConsensus<L, M, H>) -> Self
[src]
pub fn new(consensus: HandledConsensus<L, M, H>) -> Self
pub fn init(&self)
[src]
pub fn init(&self)
Calls initial actions which should be executed upon startup.
pub fn apply_peer_message(
&self,
from: ServerId,
message: PeerMessage
) -> Result<(), Error>
[src]
pub fn apply_peer_message(
&self,
from: ServerId,
message: PeerMessage
) -> Result<(), Error>
Applies a peer message to the consensus state machine.
pub fn apply_client_message(
&self,
from: ClientId,
message: ClientRequest
) -> Result<(), Error>
[src]
pub fn apply_client_message(
&self,
from: ClientId,
message: ClientRequest
) -> Result<(), Error>
Applies a client message to the consensus state machine.
pub fn apply_timeout(&self, timeout: ConsensusTimeout) -> Result<(), Error>
[src]
pub fn apply_timeout(&self, timeout: ConsensusTimeout) -> Result<(), Error>
Triggers a timeout for the peer.
pub fn heartbeat_timeout(
&self,
peer: ServerId
) -> Result<AppendEntriesRequest, Error>
[src]
pub fn heartbeat_timeout(
&self,
peer: ServerId
) -> Result<AppendEntriesRequest, Error>
Triggers a heartbeat timeout for the peer.
pub fn election_timeout(&self) -> Result<(), Error>
[src]
pub fn election_timeout(&self) -> Result<(), Error>
Trait Implementations
impl<L: Debug, M: Debug, H: Debug> Debug for SharedConsensus<L, M, H>
[src]
impl<L: Debug, M: Debug, H: Debug> Debug for SharedConsensus<L, M, H>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<L: Clone, M: Clone, H: Clone> Clone for SharedConsensus<L, M, H>
[src]
impl<L: Clone, M: Clone, H: Clone> Clone for SharedConsensus<L, M, H>
fn clone(&self) -> SharedConsensus<L, M, H>
[src]
fn clone(&self) -> SharedConsensus<L, M, H>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0
[src]Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl<L, M, H> Send for SharedConsensus<L, M, H> where
H: Send,
L: Send,
M: Send,
impl<L, M, H> Send for SharedConsensus<L, M, H> where
H: Send,
L: Send,
M: Send,
impl<L, M, H> Sync for SharedConsensus<L, M, H> where
H: Send,
L: Send,
M: Send,
impl<L, M, H> Sync for SharedConsensus<L, M, H> where
H: Send,
L: Send,
M: Send,