raft: add node.Unstable

Be able to return all unstable log entries. Application must store unstable
log entries before send out any messages after calling step.
This commit is contained in:
Xiang Li
2014-07-23 21:45:57 -07:00
committed by Yicheng Qin
parent 05e77ecf90
commit 609e13a240
3 changed files with 66 additions and 5 deletions

View File

@@ -204,3 +204,8 @@ func (n *Node) UpdateConf(t int64, c *Config) {
}
n.propose(t, data)
}
// UnstableEnts retuens all the entries that need to be persistent.
func (n *Node) UnstableEnts() []Entry {
return n.sm.raftLog.unstableEnts()
}