Skip to main content

nodedb_raft/
lib.rs

1// SPDX-License-Identifier: BUSL-1.1
2
3//! Raft consensus primitives: leader election, log replication, snapshots,
4//! membership change (joint consensus), and snapshot framing.
5//!
6//! This crate provides the algorithm only — transport, persistence, and
7//! state-machine application are the consumer's responsibility. It is
8//! consumed by `nodedb-cluster` (Multi-Raft per vShard for replicated
9//! collections) and by `nodedb` (single-group Raft for the metadata
10//! catalog and the cross-engine surrogate counter).
11
12pub mod error;
13pub mod log;
14pub mod message;
15pub mod node;
16pub mod snapshot_framing;
17pub mod state;
18pub mod storage;
19pub mod transport;
20
21pub use error::{RaftError, Result};
22pub use log::RaftLog;
23pub use message::{
24    AppendEntriesRequest, AppendEntriesResponse, InstallSnapshotRequest, InstallSnapshotResponse,
25    LogEntry, RequestVoteRequest, RequestVoteResponse,
26};
27pub use node::{RaftNode, Ready};
28pub use snapshot_framing::{
29    SNAPSHOT_FORMAT_VERSION, SNAPSHOT_MAGIC, SnapshotEngineId, SnapshotFramingError,
30    decode_snapshot_chunk, encode_snapshot_chunk,
31};
32pub use state::{HardState, NodeRole, PeerRole};
33pub use storage::LogStorage;
34pub use transport::RaftTransport;