breaker

package module
v0.0.0-...-27713f4 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2022 License: MIT Imports: 2 Imported by: 1

README

breaker

AFAIRE

Go Report Card Go Reference

Licence

MIT.


Copyright (c) 2021-2022 losyme

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Breaker

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

func New

func New(c *Config) *Breaker

func (*Breaker) IsReady

func (b *Breaker) IsReady() bool

func (*Breaker) State

func (b *Breaker) State() State

func (*Breaker) Update

func (b *Breaker) Update(success bool) State

type Config

type Config struct {
	// Closed To Open
	CToO uint
	// Half-Open To Closed
	HOToC uint
	// Open To Half-Open
	OToHO time.Duration
	CbOSC OnStateChange
}

func DefaultConfig

func DefaultConfig() *Config

type OnStateChange

type OnStateChange func(from, to State)

type State

type State string
const (
	StateClosed   State = "closed"
	StateHalfOpen State = "half_open"
	StateOpen     State = "open"
)

Jump to

Keyboard shortcuts

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