simplelogic

package
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package simplelogic is a holding place for close and open circuit logic that is otherwise simple in use or complexity.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConsecutiveErrOpenerFactory

func ConsecutiveErrOpenerFactory(config ConfigConsecutiveErrOpener) func() circuit.ClosedToOpen

ConsecutiveErrOpenerFactory constructs a new ConsecutiveErrOpener

Types

type ConfigConsecutiveErrOpener

type ConfigConsecutiveErrOpener struct {
	ErrorThreshold int64
}

ConfigConsecutiveErrOpener configures a ConsecutiveErrOpener

func (*ConfigConsecutiveErrOpener) Merge

Merge this config with another

type ConsecutiveErrOpener

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

ConsecutiveErrOpener is simple closed->open logic that opens on consecutive error counts

func (*ConsecutiveErrOpener) Closed

func (c *ConsecutiveErrOpener) Closed(_ context.Context, _ time.Time)

Closed resets the consecutive error count

func (*ConsecutiveErrOpener) ErrBadRequest

func (c *ConsecutiveErrOpener) ErrBadRequest(_ context.Context, _ time.Time, _ time.Duration)

ErrBadRequest is ignored

func (*ConsecutiveErrOpener) ErrConcurrencyLimitReject

func (c *ConsecutiveErrOpener) ErrConcurrencyLimitReject(_ context.Context, _ time.Time)

ErrConcurrencyLimitReject is ignored

func (*ConsecutiveErrOpener) ErrFailure

func (c *ConsecutiveErrOpener) ErrFailure(_ context.Context, _ time.Time, _ time.Duration)

ErrFailure increments the consecutive error counter

func (*ConsecutiveErrOpener) ErrInterrupt

func (c *ConsecutiveErrOpener) ErrInterrupt(_ context.Context, _ time.Time, _ time.Duration)

ErrInterrupt is ignored

func (*ConsecutiveErrOpener) ErrShortCircuit

func (c *ConsecutiveErrOpener) ErrShortCircuit(_ context.Context, _ time.Time)

ErrShortCircuit is ignored

func (*ConsecutiveErrOpener) ErrTimeout

func (c *ConsecutiveErrOpener) ErrTimeout(_ context.Context, _ time.Time, _ time.Duration)

ErrTimeout increments the consecutive error counter

func (*ConsecutiveErrOpener) Opened

func (c *ConsecutiveErrOpener) Opened(_ context.Context, _ time.Time)

Opened resets the error counter

func (*ConsecutiveErrOpener) Prevent

func (c *ConsecutiveErrOpener) Prevent(_ context.Context, _ time.Time) bool

Prevent always returns false

func (*ConsecutiveErrOpener) SetConfigNotThreadSafe

func (c *ConsecutiveErrOpener) SetConfigNotThreadSafe(props ConfigConsecutiveErrOpener)

SetConfigNotThreadSafe updates the error threshold

func (*ConsecutiveErrOpener) SetConfigThreadSafe

func (c *ConsecutiveErrOpener) SetConfigThreadSafe(props ConfigConsecutiveErrOpener)

SetConfigThreadSafe updates the error threshold

func (*ConsecutiveErrOpener) ShouldOpen

func (c *ConsecutiveErrOpener) ShouldOpen(_ context.Context, _ time.Time) bool

ShouldOpen returns true if enough consecutive errors have returned

func (*ConsecutiveErrOpener) Success

Success resets the consecutive error count

Jump to

Keyboard shortcuts

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