Skip to content

feat(raft): Implement the gRPC version of Raft Network#238

Open
MciG-ggg wants to merge 7 commits intoarana-db:feat/raftfrom
MciG-ggg:feat/raft
Open

feat(raft): Implement the gRPC version of Raft Network#238
MciG-ggg wants to merge 7 commits intoarana-db:feat/raftfrom
MciG-ggg:feat/raft

Conversation

@MciG-ggg
Copy link

@MciG-ggg MciG-ggg commented Feb 8, 2026

  • Use tonic as gRPC library to implement the raft network
  • Write a script scripts/start_node_cluster.sh which can start specific numbers of nodes to build a cluster. Due to the config is not load to the app, the script has to move the kiwi excutable file to several directories to start nodes. This should change when the config file is load to the app.

- Added scripts to start a 3-node Raft cluster
- Updated Cargo.lock with new dependencies
- Implemented basic API and node logic for Raft consensus algorithm
- Introduced `use_grpc` configuration option in `RaftClusterConfig` to toggle between gRPC and HTTP for node communication.
- Updated dependencies in `Cargo.toml` to include `tonic` and `prost` for gRPC support.
- Created `build.rs` to compile protobuf definitions for Raft RPC services.
- Added `raft.proto` file defining the gRPC service and message types for Raft operations.
- Implemented `RaftServiceImpl` struct to handle gRPC requests for voting, appending entries, and installing snapshots.
- Modified `KiwiNetworkFactory` to manage gRPC clients instead of HTTP clients.
- Updated `RaftApp` to create a gRPC server for handling incoming requests.
- Refactored server initialization in `main.rs` to start the gRPC server instead of the HTTP server.
- Moved gRPC service implementations into separate modules: core, admin, and client.
- Implemented RaftCoreService for handling core Raft protocol operations (vote, append entries, etc.).
- Implemented RaftAdminService for cluster management operations (initialize, add learner, change membership, remove node).
- Implemented RaftClientService and RaftMetricsService for client data operations and metrics retrieval.
- Updated network layer to use the new gRPC service clients.
- Removed the old gRPC service implementation and adjusted the RaftApp to create all gRPC services.
- Enhanced error handling and logging throughout the gRPC implementations.
- Updated Cargo.toml to include necessary dependencies for gRPC support.
@coderabbitai
Copy link

coderabbitai bot commented Feb 8, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@MciG-ggg MciG-ggg changed the title Feat/raft Implement the gRPC version of Raft Network feat(raft): Implement the gRPC version of Raft Network Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✏️ Feature new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant