Update codes

This commit is contained in:
Edward 2020-05-08 16:56:21 +08:00
parent 7762e0440f
commit 41d70fee70
2 changed files with 4 additions and 8 deletions

View File

@ -1,4 +1,3 @@
// Package breaker implements the circuit-breaker resiliency pattern for Go.
package breaker
import (

View File

@ -12,12 +12,9 @@ var (
FailureThreshold = 10
)
//State of current switch
type State int
//State of current switch
const (
UnknownState State = iota
UnknownState uint = iota
FailureState
SuccessState
)
@ -27,19 +24,19 @@ type Circuit func(context.Context) error
//Counter interface
type Counter interface {
Count(State)
Count(uint)
ConsecutiveFailures() uint32
LastActivity() time.Time
Reset()
}
type counters struct {
state State
state uint
lastActivity time.Time
counts uint32 //counts of failures
}
func (c *counters) Count(State) {
func (c *counters) Count(state uint) {
}