breaker

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBreakerOpen = errors.New("breaker: circuit breaker is open")

ErrBreakerOpen is the error returned from Run() when the breaker is open.

Functions

This section is empty.

Types

type Breaker

type Breaker struct {
	// contains filtered or unexported fields
}

Breaker implements the circuit-breaker pattern.

func New

func New(errorThreshold int, timeout time.Duration) *Breaker

New creates a new Breaker.

func (*Breaker) Error

func (b *Breaker) Error()

Error registers an error with the circuit-breaker, potentially opening the breaker.

func (*Breaker) Run

func (b *Breaker) Run(fn func()) error

Run will run the given function or return ErrBreakerOpen immediately if the circuit-breaker is open.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL