Struct raft_consensus::consensus::Consensus[][src]

pub struct Consensus<L, M> { /* fields omitted */ }

An instance of a Raft state machine. The Consensus controls a client state machine, to which it applies entries in a globally consistent order.

Each event incoming from outside, like timer or a consensus packet, shoould be passed to corresponsing finction in consensus along with the handler implementation. Then handler functions will be called when corresponsing events happen

Methods

impl<L, M> Consensus<L, M> where
    L: Log,
    M: StateMachine
[src]

Creates a Consensus.

Calls initial actions which should be executed upon startup.

Applies a peer message to the consensus state machine.

impl<L, M> Consensus<L, M> where
    L: Log,
    M: StateMachine
[src]

Client messages processing

Applies a client message to the consensus state machine.

impl<L, M> Consensus<L, M> where
    L: Log,
    M: StateMachine
[src]

Timeout handling

Triggered by external timeouts. Convenience function for handling any timeout. Will call either heartbeat_timeout or election_timeout

Triggered by a heartbeat timeout for the peer.

Triggered by an election timeout.

impl<L, M> Consensus<L, M> where
    L: Log,
    M: StateMachine
[src]

Utility functions

Returns current state of consensus state machine

Trait Implementations

impl<L: Debug, M: Debug> Debug for Consensus<L, M>
[src]

Formats the value using the given formatter. Read more

impl<L: Clone, M: Clone> Clone for Consensus<L, M>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl<L, M> Send for Consensus<L, M> where
    L: Send,
    M: Send

impl<L, M> Sync for Consensus<L, M> where
    L: Sync,
    M: Sync