VOL-2112 move to voltha-lib-go
Change-Id: Ic1af08003c1d2c698c0cce371e64f47b47b8d875
diff --git a/vendor/go.etcd.io/etcd/raft/status.go b/vendor/go.etcd.io/etcd/raft/status.go
index 9feca7c..adc6048 100644
--- a/vendor/go.etcd.io/etcd/raft/status.go
+++ b/vendor/go.etcd.io/etcd/raft/status.go
@@ -18,34 +18,44 @@
"fmt"
pb "go.etcd.io/etcd/raft/raftpb"
+ "go.etcd.io/etcd/raft/tracker"
)
+// Status contains information about this Raft peer and its view of the system.
+// The Progress is only populated on the leader.
type Status struct {
+ BasicStatus
+ Config tracker.Config
+ Progress map[uint64]tracker.Progress
+}
+
+// BasicStatus contains basic information about the Raft peer. It does not allocate.
+type BasicStatus struct {
ID uint64
pb.HardState
SoftState
- Applied uint64
- Progress map[uint64]Progress
+ Applied uint64
LeadTransferee uint64
}
-func getProgressCopy(r *raft) map[uint64]Progress {
- prs := make(map[uint64]Progress)
- for id, p := range r.prs {
- prs[id] = *p
- }
+func getProgressCopy(r *raft) map[uint64]tracker.Progress {
+ m := make(map[uint64]tracker.Progress)
+ r.prs.Visit(func(id uint64, pr *tracker.Progress) {
+ var p tracker.Progress
+ p = *pr
+ p.Inflights = pr.Inflights.Clone()
+ pr = nil
- for id, p := range r.learnerPrs {
- prs[id] = *p
- }
- return prs
+ m[id] = p
+ })
+ return m
}
-func getStatusWithoutProgress(r *raft) Status {
- s := Status{
+func getBasicStatus(r *raft) BasicStatus {
+ s := BasicStatus{
ID: r.id,
LeadTransferee: r.leadTransferee,
}
@@ -57,10 +67,12 @@
// getStatus gets a copy of the current raft status.
func getStatus(r *raft) Status {
- s := getStatusWithoutProgress(r)
+ var s Status
+ s.BasicStatus = getBasicStatus(r)
if s.RaftState == StateLeader {
s.Progress = getProgressCopy(r)
}
+ s.Config = r.prs.Config.Clone()
return s
}