Expand description
tokioraft is a small Tokio-oriented leader election library.
The crate implements a minimal Raft-inspired election state machine. It reacts to incoming peer messages, drives local election timers, and emits outgoing election messages together with local role changes.
tokioraft is intentionally narrow in scope:
- it does leader election only
- it does not implement a replicated log
- it does not provide networking or node discovery
- it does not manage cluster membership automatically
Typical integration flow:
- Create one
TinyRaftinstance per node - Read events from
TinyRaft::get_receiver_from_raft - Deliver
send::MsgRouter::ToNodemessages using your own transport - Feed received peer messages back through
TinyRaft::on_receive - Apply membership changes explicitly through
TinyRaft::set_nodes
The library is intended for Tokio-based applications and expects the host application not to block Tokio worker threads for long periods of time.
Modules§
Structs§
- Tiny
Raft - A running leader-election node.
Enums§
- Node
Type - Current election role of a node.
Type Aliases§
- NodeId
- Unique node identifier used by the election state machine.