Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCircuitOpen = errors.New("circuit breaker is open")
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// Number of failures before entering open state.
FailureThreshold int
// Time between failures to count as an outage.
FailWindow time.Duration
// How long to stay in open state before triggering half-open state.
OpenCoolDown time.Duration
// Time lease to allow only one pod instance at a time to test whether the circuit can be reopened.
HalfOpenLease time.Duration
// If Redis is unreachable (down, unavailable, timing out) and it's state is unknown, this determines the default behavior of the Allow method. What to do while breaker is blind.
// TRUE: allows requests to proceed without circuit breaker participating
// FALSE: blocks requests
FailOpen bool
// Key prefix to prevent name clashing.
Prefix string
}
func DefaultOptions ¶
func DefaultOptions() Options
type RedisBreaker ¶
type RedisBreaker struct {
// contains filtered or unexported fields
}
func NewRedisBreaker ¶
func (*RedisBreaker) OnFailure ¶
func (b *RedisBreaker) OnFailure(ctx context.Context)
func (*RedisBreaker) OnSuccess ¶
func (b *RedisBreaker) OnSuccess(ctx context.Context)
Click to show internal directories.
Click to hide internal directories.