3 releases (breaking)
Uses new Rust 2024
| 0.4.0 | Feb 5, 2026 |
|---|---|
| 0.3.0 | Feb 4, 2026 |
| 0.2.0 | Jan 18, 2026 |
#8 in #apfsds
Used in apfsds-daemon
45KB
730 lines
APFSDS Raft - Distributed consensus using async-raft
Implements Raft consensus for connection state synchronization.
apfsds-raft
Raft consensus implementation for APFSDS distributed cluster.
Features
- async-raft Integration: Built on the
async-raftcrate - Persistent Storage: WAL-backed log with HardState persistence
- ClickHouse Backup: Async export of committed entries
- Dynamic Membership: Add/remove nodes at runtime
Usage
use apfsds_raft::{RaftNode, RaftConfig};
let config = RaftConfig {
node_id: 1,
peers: vec!["192.168.1.2:25347", "192.168.1.3:25347"],
data_dir: "/var/lib/apfsds/raft".into(),
};
let node = RaftNode::new(config).await?;
// Propose a command (leader only)
node.propose(command).await?;
// Query cluster state
let leader = node.current_leader().await;
Cluster Setup
[raft]
node_id = 1
peers = ["192.168.1.2:25347", "192.168.1.3:25347"]
data_dir = "/var/lib/apfsds/raft"
License
MIT
Dependencies
~49–70MB
~1M SLoC