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, or a future I/O adapter) supply time, transport, storage, and seeds, which is what makes the whole cluster reproducible from a single seed.

Implemented at M1: leader election with Pre-Vote, log replication with conflict-term fast backup, monotonic match tracking, and persist-before-response ordering. M2 added the Figure 8 commitment suite, ReadIndex, and client deduplication. M3 adds snapshots, chunked InstallSnapshot, and single-server membership changes.

This crate is strictly std-only (DECISIONS Q5) 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::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.
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.