canonical/raft logo

canonical/raft

Free

Unmaintained C implementation of the Raft consensus protocol

FreeFree tier
Type
Open Source
Company
Canonical

About canonical/raft

A fully asynchronous C implementation of the Raft consensus protocol, originally developed by Canonical's dqlite team. The library features a modular design: a platform-independent core implementing the Raft algorithm logic, and a pluggable I/O interface for networking (send/receive RPC messages) and disk persistence (store log entries and snapshots). A stock I/O implementation based on libuv is provided, though it currently requires Linux due to its use of the Linux AIO API for disk I/O. The implementation includes all basic Raft features (leader election, log replication, log compaction, membership changes) plus optional enhancements such as optimistic pipelining, parallel writing to the leader's disk, automatic stepping down, leadership transfer, and a pre-vote protocol. The project is now archived and unmaintained; the source code has been incorporated into canonical/dqlite as a private implementation detail, and users are advised to switch to the maintained fork cowsql/raft.

Key Features

Leader election
Log replication
Log compaction
Membership changes
Optimistic pipelining for reduced log replication latency
Writing to leader's disk in parallel
Automatic stepping down when leader loses quorum
Leadership transfer extension
Pre-vote protocol
Modular design with pluggable I/O interface for networking and disk persistence

Pros & Cons

Pros
  • Mature implementation with all core Raft features and several optional enhancements
  • Modular design allows custom I/O backends
  • LGPLv3 license with static linking exception for flexible integration
  • Well-documented API (raft.h) and example server code
Cons
  • Project is archived and unmaintained (last release v0.18.1)
  • Linux-only due to dependency on Linux AIO for disk I/O
  • Stock I/O implementation requires libuv and does not support other platforms
  • Replaced by the maintained fork cowsql/raft; no further development here

Best For

Building distributed databases requiring consensusImplementing fault-tolerant state machinesEmbedding consensus in applications needing reliable replication

FAQ

Is this project still maintained?
No. The repository was archived by the owner on March 4, 2024, and is now read-only. The dqlite team no longer maintains this independent raft implementation; the source code has been incorporated into canonical/dqlite as a private detail.
What license is used?
The library is released under a slightly modified version of LGPLv3 that includes a copyright exception allowing users to statically link the library code and release the final work under their own terms.
What platforms are supported?
The stock I/O implementation currently requires Linux because it uses the Linux AIO API for disk I/O. The core library is platform-independent, but contributions would be needed to support additional platforms.
Which I/O library does the default implementation use?
The default I/O implementation is based on libuv (version 1.18.0 or later).