docs(server): add a comment explaining the NOPCommand
Merge pull request #165 from philips/add-comment-on-nop-command

docs(server): add a comment explaining the NOPCommand
fix(*.go): rename HeartbeatTimeout to HeartbeatInterval

While re-reading the etcd tuning guide I realized that perhaps it is a
bit of a misnomer to call this a "Timeout" since unlike the "Election
Timeout" there is no immediate consequence of it being missed.

Perhaps naming it interval would be better?
fix(peer.go) Make sure we use the leader's term to create AppendEntriesRequest.
We do not stop the heartbeats before increases the term of the leader. It is possible that the even after
the state check, the leader stepsdown and use the new term to send out a AppendEntries request. We fixed this by recording the term when it is the leader(if it is not the leader at that time, flush() will return in the if statement).
leader must stop all heartbeat routines before stepdown and truncate its log
Merge pull request #167 from xiangli-cmu/dev

more safety
Merge pull request #166 from philips/change-heartbeatTimeout-to-heartbeatInterval

fix(*.go): rename HeartbeatTimeout to HeartbeatInterval
merge with master
add conditions for state for loops
drop unused field in log
Merge pull request #170 from xiangli-cmu/cleanup_loops

Cleanup loops
refactor(peer): cleanup of some if boolean logic

I always get confused reading this code. Lets make it more clear, if
flush then flush; else don't flush.
fix(log): use Rlock in getEntriesAfter

getEntriesAfter only reads the log and doesn't make any motifications.
Using an RLock is safe here.
fix(server): release the server lock while stopping peers

Avoid a deadlock situation:

- Server is changing the term via setCurrentTerm() which also holds
  the server.Lock

- Peer is in the flush() routine and attempts to takes the server.Lock
  via p.server.Term() in sendAppendEntriesRequest()

The peer cannot take the lock because it is held by the server. The
server is waiting for the peer to shut down. Progress stops.
Update to github.com/coreos/raft