Crate raft_consensus [] [src]

Raft

This is a crate containing a Raft consensus protocol implementation and encoding/decoding helpers. This is a logic-only crate without any network implementations.

To use this crate in implementation, one should do the following:

  • determine and implement(or take ready ones) state machine and persistent log implementations

  • pass all raft-related messages from receivers/transmitters to Consensus structure

  • define a CollectionHandle that which functions are called at different stages of consensus defining actions depending on receive/transmit environment

Re-exports

pub use consensus::Consensus;
pub use consensus::ConsensusHandler;
pub use shared::SharedConsensus;
pub use persistent_log::Log;
pub use state_machine::StateMachine;

Modules

consensus

Implementation of Raft consensus API

error

Error type with all possible errors

handler

Handlers for consensus callbacks

message

Messages that are passed during consensus work

persistent_log

The persistent storage of Raft state.

shared

Handle consensus from many threads

state_machine

A StateMachine is a single instance of a distributed application. It is the raft libraries responsibility to take commands from the Client and apply them to each StateMachine instance in a globally consistent order.

Structs

ClientId

The ID of a Raft client.

Entry

Type representing a log entry

LogIndex

The index of a log entry.

ServerId

The ID of a Raft server. Must be unique among the participants in a consensus group.

Term

The term of a log entry.