aosabook/500lines — pull request #26 by djmitche (2014-02-12 23:47:04+00:00)
Title: Refactor into bite-sized pieces

The big work here is to "[write small things](http://larubyconf.com/proposals/64)", while also using dependency injection to make (mostly future) testing easier. Most of the existing components (Leader, Commander, Scout, and Acceptor) just moved to their own modules and changed their initialization a little. However, the Heartbeat and Bootstrap classes have been broken out of Replica, leaving Replica still the most complex, but simple enough to fit on one screen anyway.

This all has a neat advantage that I can now delay adding most of the steady-state components until the bootstrapping is complete, so none of them need to keep track of whether bootstrapping is complete (`Replica.ready` in particular).

The next step is to fix the view change protocol to follow Lamport's suggestion: the set of peers from which a quorum is required for slot N is the most recent view decided as of slot N-α. This limits the system to α slots of active proposals, and requires that decisions be communicated pretty quickly. Lamport suggests α=3, but it's an easy parameter to change as required.

@jwm, hopefully this is a lot more readable!