Skip to content

feat(cluster): add cluster membership management#101

Merged
slow2342 merged 1 commit into
mainfrom
feat/cluster-membership
Jun 9, 2026
Merged

feat(cluster): add cluster membership management#101
slow2342 merged 1 commit into
mainfrom
feat/cluster-membership

Conversation

@slow2342

@slow2342 slow2342 commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Summary

Add cluster membership management support with Raft RPC layer and gRPC cluster service. This enables multi-node cluster formation, member addition/removal, and inter-node Raft communication.

Changes

  • proto/raft.proto — New RaftRPC service for inter-node communication (AppendEntries, Vote, InstallSnapshot) with serde_json-encoded payloads.
  • proto/cluster.proto — New AetherCluster service with MemberList, MemberAdd, MemberRemove RPCs.
  • src/raft/network.rs — Replace stub network with real tonic gRPC client. Lazy connection, per-RPC timeouts (AE 5s, Vote 2s, Snapshot 60s).
  • src/raft/rpc.rs — New Raft RPC server implementation that deserializes JSON payloads and delegates to the openraft instance.
  • src/api/cluster.rs — New ClusterService implementing AetherCluster trait. Leadership check, auto-generated node IDs, two-step member removal.
  • src/storage/rocksdb.rs — Refactor to Arc<DB>, add raft_log/raft_state column families, expose db() for shared access.
  • src/main.rs — Wire up full Raft lifecycle: log store, state machine, network, bootstrap, register all three gRPC services.
  • src/error.rs — Add NotLeader and Raft error variants.
  • build.rs — Compile all three proto files.
  • Cargo.toml — Add async-trait dependency.

Testing

  • cargo build — passes
  • cargo test — 10 tests pass
  • cargo clippy -- -D warnings — no warnings
  • cargo fmt -- --check — passes

Related issues

Refs #77

Add Raft RPC layer, cluster service, and wire up Raft lifecycle.

- Add raft.proto with RaftRPC service (AppendEntries, Vote, InstallSnapshot)
- Add cluster.proto with AetherCluster service (MemberList, MemberAdd, MemberRemove)
- Implement Raft network layer with tonic gRPC client and timeouts
- Implement Raft RPC server that delegates to openraft instance
- Implement ClusterService with leadership check and membership operations
- Refactor RocksStorage to Arc<DB> with raft_log/raft_state column families
- Wire up full Raft lifecycle in main.rs (log store, state machine, bootstrap)
- Add NotLeader and Raft error variants to AetherError
@slow2342
slow2342 merged commit a7cc7fb into main Jun 9, 2026
4 of 8 checks passed
@slow2342
slow2342 deleted the feat/cluster-membership branch June 9, 2026 11:23
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