coreos/etcd — pull request #1765 by bdarnell (2014-11-21 22:48:43+00:00)
Title: raft: Log storage interface

These commits split raftLog into "stable" and "unstable" portions and allows applications to load stable entries from disk as needed instead of retaining the entire log in memory. Snapshots have been reworked and are now supplied by the Storage implementation. The etcd WAL should presumably implement this interface, although I haven't made that change yet (etcd just uses a MemoryStorage alongside the WAL to mimic the old behavior for now).

Commit 64d9bca changes the behavior of firstIndex, which no longer includes the dummy entry at the beginning of the log. This entry is no longer directly accessible and is not considered to be a part of the log, but its Term attribute can be accessed for matching in append().

This branch is not quite ready to merge as-is (it needs more raft-level test coverage of restoring from a snapshot), but I'm opening the PR now so @xiang90 and @yichengq can pick it up next week (while I'm mostly unavailable).