ariskk / zio-raft   0.3.0

MIT License GitHub

An Implementation of Raft using ZIO in Scala

Scala versions: 2.13


License: MIT CI

An Implementation of Raft using ZIO in Scala.


Raft is a popular consensus algorithm. It solves the problem of multiple servers needing to agree on a single value. It is a coordination primitive often used in databases and other distributed systems. For more info, check out the paper

This is a work in progress implementation in Scala using ZIO for effect management. Log, Storage and StateMachine are pluggable and thus different implementations can be provided. The repo currently provides a Storage implementation using RocksDB.

Raft contains the core implementation of the consensus algorithm. The implementation is fully asynchronous. The consensus module is decoupled from the RPC layer and communicates with the outside world using Queues. RaftServer contains a reference implementation of RPC using a lightweight ZIO wrapper around Java's NIO.

For examples on how to use the RaftServer, please refer to RaftServerSpec