Skip to main content

Crate simraft_core

Crate simraft_core 

Source
Expand description

simraft-core: a pure sans-I/O Raft consensus state machine.

A Node consumes Event values and returns Action values. It reads no clock, opens no socket, touches no disk, spawns no thread, and draws no randomness from the operating system. Drivers (the deterministic simulator in simraft-sim and the TCP/file adapter in simraft-node) supply time, transport, storage, and seeds, which is what makes the whole cluster reproducible from a single seed.

Protocol features: leader election with Pre-Vote, log replication with conflict-term fast backup, monotonic match tracking, persist-before-response ordering, Figure 8 commitment, clock-free linearizable reads via ReadIndex, in-flight client deduplication, snapshots with chunked InstallSnapshot transfer, and single-server membership changes.

This crate depends only on std and forbids unsafe code.

Re-exports§

pub use action::Action;
pub use action::ClientResult;
pub use action::ConfigResult;
pub use config::Config;
pub use error::ConfigError;
pub use error::ProtocolError;
pub use error::SnapshotError;
pub use event::Event;
pub use event::HardState;
pub use event::PersistKind;
pub use ids::ClientId;
pub use ids::LogIndex;
pub use ids::NodeId;
pub use ids::Term;
pub use ids::Tick;
pub use log::EntryKind;
pub use log::Log;
pub use log::LogEntry;
pub use membership::ClusterConfig;
pub use membership::ConfigChange;
pub use membership::ConfigState;
pub use message::Message;
pub use node::Node;
pub use node::NodeStats;
pub use node::PeerStats;
pub use node::Role;
pub use snapshot::SnapshotMeta;

Modules§

action
Outputs of the sans-I/O core.
config
Static configuration for a Raft node and its validation.
error
Domain error types for simraft-core.
event
Inputs to the sans-I/O core.
ids
Identifier and index newtypes shared by every simraft-core module.
log
The replicated log: a contiguous entry vector behind a snapshot base.
membership
Cluster configuration representation and single-server membership change rules (AddLearner, PromoteVoter, RemoveVoter).
message
RPC messages between nodes, as structured values.
node
The Raft node: a pure sans-I/O state machine.
snapshot
Snapshot metadata and chunk transfer state.