package breaker
import "github.com/google/cadvisor/Godeps/_workspace/src/github.com/eapache/go-resiliency/breaker"
Package breaker implements the circuit-breaker resiliency pattern for Go.
Index ¶
Variables ¶
ErrBreakerOpen is the error returned from Run() when the function is not executed because the breaker is currently open.
Types ¶
type Breaker ¶
type Breaker struct {
// contains filtered or unexported fields
}
Breaker implements the circuit-breaker resiliency pattern
func New ¶
New constructs a new circuit-breaker that starts closed. From closed, the breaker opens if "errorThreshold" errors are seen without an error-free period of at least "timeout". From open, the breaker half-closes after "timeout". From half-open, the breaker closes after "successThreshold" consecutive successes, or opens on a single error.
func (*Breaker) Go ¶
Go will either return ErrBreakerOpen immediately if the circuit-breaker is already open, or it will run the given function in a separate goroutine. If the function is run, Go will return nil immediately, and will *not* return the return value of the function. It is safe to call Go concurrently on the same Breaker.
func (*Breaker) Run ¶
Run will either return ErrBreakerOpen immediately if the circuit-breaker is already open, or it will run the given function and pass along its return value. It is safe to call Run concurrently on the same Breaker.
Source Files ¶
- Version
- v0.23.6
- Published
- Jun 24, 2016
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 1 hour ago –
Tools for package owners.