Raft
Raft consensus algorithm implementation for Crystal.
Provides a library for building distributed systems with strong consistency
guarantees. A cluster of Raft::Node instances elect a leader, replicate a
command log, and apply committed entries to a user-provided state machine.
node = Raft::Node.new(
id: "node-1",
peers: ["node-2", "node-3"],
state_machine: my_state_machine,
transport: Raft::Transport::InMemory.new("node-1"),
log: Raft::Log::InMemory.new,
)
node.start
result = node.propose("SET key value".to_slice)
node.stop
Constants
VERSION = "0.2.0"