Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
ErrServiceUnavailable is returned when the Breaker state is open.
Functions ¶
Types ¶
type Acceptable ¶
Acceptable is the func to check if the error can be accepted.
type Breaker ¶
type Breaker interface {
// Name returns the name of the Breaker.
Name() string
// Allow checks if the request is allowed.
// If allowed, a promise will be returned, the caller needs to call promise.Accept()
// on success, or call promise.Reject() on failure.
// If not allow, ErrServiceUnavailable will be returned.
Allow() (Promise, error)
}
A Breaker represents a circuit breaker.
func NewBreaker ¶
NewBreaker returns a Breaker object. opts can be used to customize the Breaker.
Click to show internal directories.
Click to hide internal directories.