--- Paxos Proposer ---
1 proposer(v):
2 choose n > np
3 send prepare(n) to all servers including self
4 if prepare_ok(na, va) from majority:
5 v' = va with highest na; choose own v otherwise
6 send accept(n, v') to all
7 if accept_ok(n) from majority:
8 send decided(v') to all
--- Paxos Acceptor ---
9 acceptor state on each node (persistent):
10 np --- highest prepare seen
11 na, va --- highest accept seen
12 acceptor's prepare(n) handler:
13 if n > np
14 np = n
15 reply prepare_ok(na, va)
16 acceptor's accept(n, v) handler:
17 if n >= np
18 np = n
19 na = n
20 va = v
21 reply accept_ok(n)