What it is
paros-consensus holds the Paxos roles as plain state machines: proposer, acceptor, replica, matchmaker, proxy leader, batcher, leaderless reader. It does no I/O, it reads no clock and it draws no random number. It uses std only, and withdefault-features = false it has no dependency. Your program, the driver, owns the sockets, the disk and the timers. So the same code runs in a unit test, in a simulation, in this browser (compiled to wasm) and behind a real network.
It is a general library. You can use it for plain Multi-Paxos with a fixed membership, or for one single-decree choice, with no part of the paros journal. A deployment runs what itsConfig names: the quorum system, the matchmakers, the proxy leaders and the replicas. No cargo feature changes a decision. With no matchmakers, plain Multi-Paxos sends no matchmaker message and writes no extra state, and a reconfiguration is refused. What the paros journal needs comes from optional behaviour and composition, never from a service concept inside the core (architecture §4.3).
Each flavor, and where it is
Each row is a flavor that a Paxos page teaches, the type that builds it, and an example that runs it. Run an example withcargo run -p paros-consensus --example <name>: each prints a trace and asserts the property that it shows.
| Flavor | In the crate | Page | Example |
|---|---|---|---|
| Single-decree Paxos | decree::Decree | Single decree | single_decree |
| Multi-Paxos | ColocatedNode | Multi-Paxos | multi_paxos, quickstart, journal_calls |
| Leader handoff | ColocatedNode::relinquish_to | Multi-Paxos | leader_handoff |
| Matchmaker Paxos | Matchmaker, MatchmakerReconfigurer | Matchmaker | matchmaker, reconfiguration |
| Proxy leaders | ProxyLeader | Compartmentalized | proxy_leader |
| Batchers | batcher::Batcher, batcher::Unbatcher | Compartmentalized | none yet |
| Replicas | ReplicaNode | Compartmentalized | replica_tier |
| Leaderless reads | quorum_read::QuorumReads | Compartmentalized | quorum_read |
| Grid quorums | membership::QuorumSystem | Quorums | acceptor_grid |
Three layers
The crate has three layers, and each layer uses only the layers below it. A role never uses a deployment, and a deployment never uses another deployment. CI checks this withscripts/check-core-layers.sh.
A role knows only what the caller gives it. The proposer builds no message, the acceptor never reads the chosen prefix, and the replica never sees a ballot tally. Each quorum question goes through membership (has_phase1_quorum,has_phase2_quorum), so a new quorum system is a new QuorumSystemvariant and no tally changes.
The log is a journal
The log of ColocatedNode carries a journal: a Write appends records at a position, SetLeader names the client that may write, and Truncate drops a prefix. The core judges no command at propose. Each node judges a command when its slot is applied, in slot order, so each node gives the same Outcome. A write on a journal with no writer is chosen by Paxos and refused by the journal.
The pages
- The driver loopInput in, one
Readyout: persist, then send, then learn. Be the driver of three nodes. - The deploymentsThe colocated node, the proxy leader, the replica and the matchmaker: what each runs, and when to use it.
- How it is checkedA TLA+ model for each flavor, each walk checked against its model, faults on, every probe reached, mutants caught.
In paros
crates/lib/paros-consensus/README.md: the entry point, with the driver loop and the examples.src/lib.rs: the crate root. Its quick start is a doc test with three nodes.AGENTS.md: the map of the modules and the rules for a change.examples/: seven examples that drive the deployments, and four lessons that drive the roles by hand.