breaker

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2020 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// StateClosed when circuit breaker closed, request allowed, the breaker
	// calc the succeed ratio, if request num greater request setting and
	// ratio lower than the setting ratio, then reset state to open.
	StateClosed int32 = iota
	// StateOpen when circuit breaker open, request not allowed, after sleep
	// some duration, allow one single request for testing the health, if ok
	// then state reset to closed, if not continue the step.
	StateOpen
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Breaker

type Breaker interface {
	Allow() error
	Accept()
	Reject()
}

type BreakerGroup

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

func NewBreakerGroup

func NewBreakerGroup() *BreakerGroup

func (*BreakerGroup) Do

func (bg *BreakerGroup) Do(name string, run func() error, accept func(error) bool) error

func (*BreakerGroup) Get

func (bg *BreakerGroup) Get(name string) Breaker

type GoogleSreBreakerConfig

type GoogleSreBreakerConfig struct {
	K          float64
	Window     time.Duration
	BucketSize int
}

type Proba

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

func NewProba

func NewProba() *Proba

func (*Proba) TrueOnProba

func (p *Proba) TrueOnProba(proba float64) bool

Jump to

Keyboard shortcuts

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