benbjohnson/go-raft — pull request #81 by xiangli-cmu (2013-07-22 21:39:12+00:00)
Title: Fix log

1. Store commitIndex at the head of the log file. When ```join``` or ```remove``` a peer, we update the commitIndex.
We need to keep that since when we restart we must recover the cluster configuration.
I do not keep the configuration in a separate file. Since recording the commitIndex will actually help us to recover some commands that we will certain recover too.
We recovery all other commands until we receive the AE from the leader

2. Add a ```position``` field for ```logEntry``` that record the start position of this entry in the log file.

3. Store the entry to the disk as soon as we receive the AE from the leader rather than at the time we commit it.

4. Also truncate the file when truncate log entries, since we have stored them on the file after step 2.