Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrClosed is the special error type that indicates that breaker is closed and that is not executing functions at the moment. ErrClosed = errors.New("breaker closed") )
Functions ¶
This section is empty.
Types ¶
type Interface ¶
type Interface interface {
// Execute runs f() if the limit number of consecutive failed calls is not reached within fail interval.
// f() call is not locked so it can still be executed concurrently.
// Returns `ErrClosed` if the limit is reached or f() result otherwise.
Execute(f func() error) error
// ClosedUntil returns the timestamp when the breaker will become open again.
ClosedUntil() time.Time
}
func NewBreaker ¶
Click to show internal directories.
Click to hide internal directories.