Paxos in 25 Lines
nil.csail.mit.edu
Paxos in 25 Lines
1–10 of 40 posts
Re: Paxos in 25 Lines
#2 1 proposer(v):
2 while not decided:
2 choose n, unique and higher than any n seen so far
26 lines.It's pseudocode, so not really only 26 lines as it needs some more supporting functions to "choose n, unique and..." and other stuff to make setting variable states atomic.
Good way to explain the algo though.
Re: Paxos in 25 Lines
#3Re: Paxos in 25 Lines
#4A choice quote: "While Paxos can be described with a page of pseudo-code, our complete implementation contains several thousand lines of C++ code."
1: https://static.googleusercontent.com/media/research.google.c...
Re: Paxos in 25 Lines
#5just type 8.5: code here
(float to insert between lines)
also no nesting.
then run a processor like go-fmt that checks the format for you.
and use the directory structure for class and methods, directory is a class, and a filename is a method.
Re: Paxos in 25 Lines
#6https://github.com/scalien/scaliendb/tree/master/src/Framewo...
Paxos: for replicating data
PaxosLease: for negotiating a lease, eg. leader
Quorum: pluggable "majority" rules, not that important
ReplicatedLog: use Paxos for each append, initiated by leader
Re: Paxos in 25 Lines
#7That process can of course be optimized in a number of ways that drastically cut down on the network overhead as compared to the naive MxN write pattern, but what's written here is not safe on its own.
Re: Paxos in 25 Lines
#81 proposer(v): 2 while not decided: 2 choose n, unique and higher than any n seen so far 26 lines. It's pseudocode, so not really only 26 lines as it needs some more supporting functions to "choose n, unique and..." and other stuff to make setting variable states atomic. Good way to explain the algo though.
Re: Paxos in 25 Lines
#9RAFT Explained – Part 1/3: Introduction to the Consensus Problem http://container-solutions.com/raft-explained-part-1-the-con...
"While Paxos can be described with a page of pseudo-code, our complete implementation contains several thousand lines of C++ code."
Re: Paxos in 25 Lines
#10run_paxos()