breaker

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: MIT Imports: 11 Imported by: 110

Documentation

Index

Constants

This section is empty.

Variables

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

ErrServiceUnavailable is returned when the Breaker state is open.

Functions

func Do

func Do(name string, req func() error) error

Do calls Breaker.Do on the Breaker with given name.

func DoWithAcceptable

func DoWithAcceptable(name string, req func() error, acceptable Acceptable) error

DoWithAcceptable calls Breaker.DoWithAcceptable on the Breaker with given name.

func DoWithFallback

func DoWithFallback(name string, req func() error, fallback func(err error) error) error

DoWithFallback calls Breaker.DoWithFallback on the Breaker with given name.

func DoWithFallbackAcceptable

func DoWithFallbackAcceptable(name string, req func() error, fallback func(err error) error,
	acceptable Acceptable) error

DoWithFallbackAcceptable calls Breaker.DoWithFallbackAcceptable on the Breaker with given name.

func NoBreakerFor

func NoBreakerFor(name string)

NoBreakerFor disables the circuit breaker for the given name.

Types

type Acceptable

type Acceptable func(err error) bool

Acceptable is the func to check if the error can be accepted.

type