#raft #raft-consensus #consensus-algorithm #message #replication #no-std #api

no-std simple-raft

A minimal implementation of the Raft consensus algorithm

1 unstable release

0.2.0 Sep 28, 2021

#131 in Database implementations

AGPL-3.0-or-later

98KB
1.5K SLoC

Raft

A Rust implementation of the Raft consensus algorithm, focused on:

  • Correctness and readability. The core implementation is written alongside the original Raft TLA+ specification to aid auditability.
  • Simplicity. Some optional features described in Diego Ongaro's Raft thesis such as pre-voting, membership changes, and snapshots are currently not implemented.
  • Usability. A primary goal of the API to be simple and not error-prone.

Important caveats:

  • Unicast message delivery is assumed to be non-lossy in order for replication to make progress. In other words, once a non-broadcast message is returned from an API, it must be retained and retransmitted until it is acknowledged as delivered by its destination. Messages may be safely delivered out-of-order or more than once, however. To prevent unbounded queueing, the API is designed to only ever return a bounded amount of unacknowledged unicast message data.

This crate is no_std, but depends on the alloc crate.

API Documentation
Examples

Crate Features

This crate has the following optional features:

  • prost enables optional protobuf serialization of Raft messages. A corresponding protobuf file is also provided.

License

Copyright (C) 2019 Open Whisper Systems
Copyright (C) 2021 jessa0

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Dependencies

~2.5MB
~51K SLoC