Sign inSign up

citacloud/consensus_raft

By citacloud

•Updated over 3 years ago

Image
0

10K+

citacloud/consensus_raft repository overview

⁠consensus_raft

Build Status

The raft consensus component for CITA Cloud.

It uses raft-rs⁠ as the raft implementation.

⁠Usage

cargo build --release

You may find more details in runner_k8s⁠ and runner_consul⁠

⁠Build docker image

docker build -t citacloud/consensus_raft .

⁠Build your own consensus service

Please check the ConsensusService⁠ and Consensus2ControllerService⁠ in cita_cloud_proto⁠ which defines the service that consensus should implement.

The main workflow for consensus service is as follow:

  1. Get proposal either from the local controller or from other remote consensus peers.
  2. If the proposal comes from peers, ask the local controller to check it first.
  3. Achieve consensus over the given proposal.
  4. Commit the proposal with its proof to the local controller.

The proof, for example, is the nonce for POW consensus, and is empty for non-byzantine consensus like this raft implementation. It will be used later by peers' controller to validate the corresponding block when they sync the missing blocks from others.

To communicate with other peers, you need to:

  1. Implement the NetworkMsgHandlerService⁠ which handles the messages from peers.
  2. Register your service to the network by RegisterNetworkMsgHandler⁠, which tells the network to forward the messages you are concerned about.

After all of that, you can send your messages to others by SendMsg⁠ or Broadcast⁠ provided by the network service.

Tag summary

Content type

Image

Digest

sha256:ccb30b169…

Size

38.7 MB

Last updated

over 3 years ago

docker pull citacloud/consensus_raft:v6.6.5