circuitbreaker

package
v0.179.12 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CircuitBreaker

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

func NewCircuitBreaker

func NewCircuitBreaker(config Config) *CircuitBreaker

func (*CircuitBreaker) Execute

func (eh *CircuitBreaker) Execute(cmd Command) CommandResult

This a blocking function

type Command

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

func NewCommand

func NewCommand(functors []*Functor) *Command

func (*Command) Add

func (cmd *Command) Add(ftor *Functor)

func (*Command) IsEmpty

func (cmd *Command) IsEmpty() bool

type CommandResult

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

func (CommandResult) Error

func (cr CommandResult) Error() error

func (CommandResult) Result

func (cr CommandResult) Result() []any

type Config

type Config struct {
	CommandName            string
	Timeout                int
	MaxConcurrentRequests  int
	RequestVolumeThreshold int
	SleepWindow            int
	ErrorPercentThreshold  int
}

type FallbackFunc

type FallbackFunc func() ([]any, error)

type Functor

type Functor struct {
	Exec FallbackFunc
}

func NewFunctor

func NewFunctor(exec FallbackFunc) *Functor

Jump to

Keyboard shortcuts

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