circuitbreaker

package module
v0.0.0-...-fedc6fd Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

README

circuitbreaker

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultOpts defaultOpts
View Source
var (
	OpenStateErr = errors.New("Circuit breaker is opened ")
)

Functions

func NewCircuitBreaker

func NewCircuitBreaker(conf *Config) *defaultCircuitBreaker

func NewSettings

func NewSettings() *defaultSettings

Types

type CircuitBreaker

type CircuitBreaker interface {
	GetState() State

	Run(runnable Runnable) error

	Go(runnable, fallback Runnable) error

	io.Closer
}

type Config

type Config struct {
	Interval time.Duration

	Counter counter.Counter

	Settings Settings
}

type Event

type Event int8
const (
	EventTriggered Event = iota
	EventFailure
	EventSuccess
	EventExpired
)

func (Event) String

func (e Event) String() string

type Opt

type Opt func(Settings)

type Runnable

type Runnable func() error

type Settings

type Settings interface {
	Set(key string, value interface{}) Settings
}

type State

type State int32
const (
	StateClosed   State = 0
	StateOpen     State = 1
	StateHalfOpen State = 2
)

func (State) String

func (s State) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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