circuitbreaker

package
v1.26.2-121.2 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Settings

type Settings struct {
	// For the following options, check gobreaker docs for details.
	Name          string
	ReadyToTrip   func(counts gobreaker.Counts) bool
	OnStateChange func(name string, from gobreaker.State, to gobreaker.State)
}

type TwoStepCircuitBreaker

type TwoStepCircuitBreaker interface {
	Name() string
	State() gobreaker.State
	Counts() gobreaker.Counts
	Allow() (done func(success bool), err error)
}

type TwoStepCircuitBreakerWithDynamicSettings

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

TwoStepCircuitBreakerWithDynamicSettings is a wrapper of gobreaker.TwoStepCircuitBreaker that calls the settingsFn everytime the Allow function is called and replaces the circuit breaker if there is a change in the settings object. Note that in this case, the previous state of the circuit breaker is lost.

func NewTwoStepCircuitBreakerWithDynamicSettings

func NewTwoStepCircuitBreakerWithDynamicSettings(
	settings Settings,
) *TwoStepCircuitBreakerWithDynamicSettings

Caller must call UpdateSettings once before using this object.

func (*TwoStepCircuitBreakerWithDynamicSettings) Allow

func (c *TwoStepCircuitBreakerWithDynamicSettings) Allow() (done func(success bool), err error)

func (*TwoStepCircuitBreakerWithDynamicSettings) Counts

func (*TwoStepCircuitBreakerWithDynamicSettings) Name

func (*TwoStepCircuitBreakerWithDynamicSettings) State

func (*TwoStepCircuitBreakerWithDynamicSettings) UpdateSettings

Jump to

Keyboard shortcuts

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