Integrate raft algorithm (WIP)

couch_raft.erl is a complete implementation of the raft algorithm but
currently only manages an in-memory state machine and log.

Preliminary work is also here to add a new btree inside the `.couch`
files, which will be the real raft log. The intent is that log entries
can be removed from this log and applied to by_id and by_seq trees
atomically.

raft log is preserved over compaction in the same manner as local
docs, all entries are slurped into memory and written in one
pass. This should be fine as the log should stay short, committed
entries can be promptly removed. It's probably not fine for local
docs, though...

Anyway, it's progress and hopefully we're going somewhere cool.
9 files changed