godep: update etcd to 3.0.12

This commit is contained in:
Hongchao Deng
2016-10-10 09:33:51 -07:00
parent 3c9600e4c4
commit c060417ecb
25 changed files with 1119 additions and 766 deletions

View File

@@ -14,6 +14,7 @@ type Status interface {
Total() int64
Loss() int64
Health() bool
Err() error
// Estimated smoothed round trip time
SRTT() time.Duration
// Estimated clock difference
@@ -27,6 +28,7 @@ type status struct {
total int64
loss int64
health bool
err error
clockdiff time.Duration
stopC chan struct{}
}
@@ -56,6 +58,12 @@ func (s *status) Health() bool {
return s.health
}
func (s *status) Err() error {
s.mu.Lock()
defer s.mu.Unlock()
return s.err
}
func (s *status) ClockDiff() time.Duration {
s.mu.Lock()
defer s.mu.Unlock()
@@ -74,15 +82,17 @@ func (s *status) record(rtt time.Duration, when time.Time) {
s.health = true
s.srtt = time.Duration((1-α)*float64(s.srtt) + α*float64(rtt))
s.clockdiff = time.Now().Sub(when) - s.srtt/2
s.err = nil
}
func (s *status) recordFailure() {
func (s *status) recordFailure(err error) {
s.mu.Lock()
defer s.mu.Unlock()
s.total++
s.health = false
s.loss += 1
s.err = err
}
func (s *status) reset() {
@@ -91,6 +101,8 @@ func (s *status) reset() {
s.srtt = 0
s.total = 0
s.loss = 0
s.health = false
s.clockdiff = 0
s.err = nil
}