raft: public progress struct in raft

This commit is contained in:
Xiang Li
2015-01-20 10:26:22 -08:00
parent b34936b097
commit 003b97a60f
3 changed files with 84 additions and 83 deletions

View File

@ -27,9 +27,10 @@ type Status struct {
SoftState
Applied uint64
Progress map[uint64]progress
Progress map[uint64]Progress
}
// getStatus gets a copy of the current raft status.
func getStatus(r *raft) Status {
s := Status{ID: r.id}
s.HardState = r.HardState
@ -38,7 +39,7 @@ func getStatus(r *raft) Status {
s.Applied = r.raftLog.applied
if s.RaftState == StateLeader {
s.Progress = make(map[uint64]progress)
s.Progress = make(map[uint64]Progress)
for id, p := range r.prs {
s.Progress[id] = *p
}