breaker

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2022 License: MIT Imports: 2 Imported by: 1

README

breaker

TODO


Copyright (c) 2022 Archivage Numérique

Documentation

Overview

Package breaker TODO

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(cfg *Config) *Breaker

func (*Breaker) State

func (b *Breaker) State() State

func (*Breaker) Update

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

func (*Breaker) Usable

func (b *Breaker) Usable() bool

type Config

type Config struct {
	Name              string        `dm:"name"`
	CloseToOpen       uint          `dm:"close_to_open"`
	HalfOpenToClose   uint          `dm:"half_open_to_close"`
	OpenToHalfOpen    time.Duration `dm:"open_to_half_open"`
	OnStateChangeFunc OnStateChangeFunc
}

type OnStateChangeFunc

type OnStateChangeFunc func(name string, to, from 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