This was my code from David Beazley's amazing Rafting Trip training course, where we tried to implement the raft distributed consensus algorithm in a week.
I didn't finish, but I got fairly far. Code here for my archive.
- transaction log class with accept/reject logic for append requests
- vaguely ports & adapters architecture, with raft protocol classes as core domain
- optional persistent log storage adapter
- log replication leader -> follower, with backtracking algorithm
- heartbeats + time events
- elections, including timeouts, conversion to candidate, voting, promotion to leader
-
RaftNet
abstraction for transport, with fake version for tests -
run_server()
andclock_tick()
abstractions for running the algo over time - ability to unit test / simulate interaction of multiple nodes in-memory
- end-to-end and integration tests
- client interactions
<--
this is the big missing piece, which might have caused me to rethink the architecture. may require some intermediary piece in between Server objects /run_server()
and clients. - cluster membership changes