raft: hide Campaign rules on applying all entries

This commit is contained in:
Xiang Li
2016-07-25 15:06:57 -07:00
parent ec5c5d9ddf
commit 484f579905
5 changed files with 60 additions and 37 deletions

View File

@@ -103,9 +103,14 @@ func NewRawNode(config *Config, peers []Peer) (*RawNode, error) {
r.addNode(peer.ID)
}
}
// Set the initial hard and soft states after performing all initialization.
rn.prevSoftSt = r.softState()
rn.prevHardSt = r.hardState()
if lastIndex == 0 {
rn.prevHardSt = emptyState
} else {
rn.prevHardSt = r.hardState()
}
return rn, nil
}