Documentation
¶
Overview ¶
Package circuit provides a circuit breaker pattern for resilience. When failures exceed a threshold, the circuit opens and fails fast. After a timeout, the circuit transitions to half-open to test recovery.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrOpen = errors.New("circuit breaker is open")
ErrOpen is returned when the circuit is open.
Functions ¶
Types ¶
type Breaker ¶
type Breaker struct {
// contains filtered or unexported fields
}
Breaker is a circuit breaker.
func (*Breaker) RecordFailure ¶
func (b *Breaker) RecordFailure()
RecordFailure records a failed call.
func (*Breaker) RecordSuccess ¶
func (b *Breaker) RecordSuccess()
RecordSuccess records a successful call.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages multiple named circuit breakers.
func NewManager ¶
NewManager creates a new circuit breaker manager.
Click to show internal directories.
Click to hide internal directories.