raft: add Node.Next

This commit is contained in:
Blake Mizerany
2014-05-19 00:24:02 -07:00
committed by Yicheng Qin
parent 9545662c6b
commit 6e0a668455
2 changed files with 11 additions and 2 deletions

View File

@@ -29,3 +29,11 @@ func (n *Node) Step(m Message) {
defer n.lk.Unlock()
n.sm.Step(m)
}
// Next advances the commit index and returns any new
// commitable entries.
func (n *Node) Next() []Entry {
n.lk.Lock()
defer n.lk.Unlock()
return n.sm.nextEnts()
}