Skip to content

feat(raft): add Raft consensus layer with openraft#98

Merged
slow2342 merged 1 commit into
mainfrom
feat/raft-consensus
Jun 8, 2026
Merged

feat(raft): add Raft consensus layer with openraft#98
slow2342 merged 1 commit into
mainfrom
feat/raft-consensus

Conversation

@slow2342

@slow2342 slow2342 commented Jun 8, 2026

Copy link
Copy Markdown
Owner

Summary

Raft consensus layer based on openraft 0.9. State machine uses in-memory BTreeMap as placeholder — will be replaced with RocksDB in the next PR.

Changes

  • src/raft/mod.rs — TypeConfig definition, RaftRequest/RaftResponse enums, and data types (KeyValue, Compare, etc.) shared across all Raft modules.

  • src/raft/state_machine.rs — RaftStateMachine implementation. Applies committed log entries: Put/Delete modify state, Txn supports compare-and-swap, Get/Range are read-only and don't go through Raft log.

  • src/raft/log_store.rs — RaftLogStorage implementation backed by RocksDB column families (raft_log, raft_state). All writes use sync for durability.

  • src/raft/network.rs — RaftNetworkFactory/RaftNetwork stub. Will be wired with tonic gRPC in the API layer PR.

  • src/raft/snapshot.rs — SnapshotManager for disk-based snapshot file I/O.

  • Cargo.toml — Added openraft, tonic, prost, rkyv, futures, serde_json dependencies.

Implement the Raft consensus layer based on openraft 0.9, including:

- TypeConfig with RaftRequest/RaftResponse enums for Put/Delete/Txn
- AetherStateMachine: applies committed log entries to in-memory store
  (BTreeMap placeholder, will be replaced with RocksDB in next PR)
- AetherLogStore: persists Raft logs and vote state in RocksDB column
  families (raft_log, raft_state) with sync writes
- AetherNetwork: stub RaftNetwork implementation for inter-node RPC
  (will be wired with tonic gRPC in API layer PR)
- SnapshotManager: disk-based snapshot file management

Dependencies added: openraft, tonic, prost, rkyv, futures, serde_json
@slow2342 slow2342 merged commit a059d3f into main Jun 8, 2026
7 of 9 checks passed
@slow2342 slow2342 deleted the feat/raft-consensus branch June 9, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant