Documentation ¶
Overview ¶
Package simplelogic is a holding place for close and open circuit logic that is otherwise simple in use or complexity.
Index ¶
- func ConsecutiveErrOpenerFactory(config ConfigConsecutiveErrOpener) func() circuit.ClosedToOpen
- type ConfigConsecutiveErrOpener
- type ConsecutiveErrOpener
- func (c *ConsecutiveErrOpener) Closed(_ context.Context, _ time.Time)
- func (c *ConsecutiveErrOpener) ErrBadRequest(_ context.Context, _ time.Time, _ time.Duration)
- func (c *ConsecutiveErrOpener) ErrConcurrencyLimitReject(_ context.Context, _ time.Time)
- func (c *ConsecutiveErrOpener) ErrFailure(_ context.Context, _ time.Time, _ time.Duration)
- func (c *ConsecutiveErrOpener) ErrInterrupt(_ context.Context, _ time.Time, _ time.Duration)
- func (c *ConsecutiveErrOpener) ErrShortCircuit(_ context.Context, _ time.Time)
- func (c *ConsecutiveErrOpener) ErrTimeout(_ context.Context, _ time.Time, _ time.Duration)
- func (c *ConsecutiveErrOpener) Opened(_ context.Context, _ time.Time)
- func (c *ConsecutiveErrOpener) Prevent(_ context.Context, _ time.Time) bool
- func (c *ConsecutiveErrOpener) SetConfigNotThreadSafe(props ConfigConsecutiveErrOpener)
- func (c *ConsecutiveErrOpener) SetConfigThreadSafe(props ConfigConsecutiveErrOpener)
- func (c *ConsecutiveErrOpener) ShouldOpen(_ context.Context, _ time.Time) bool
- func (c *ConsecutiveErrOpener) Success(_ context.Context, _ time.Time, _ time.Duration)
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 ¶
func (c *ConfigConsecutiveErrOpener) Merge(other ConfigConsecutiveErrOpener)
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 ¶
ErrBadRequest is ignored
func (*ConsecutiveErrOpener) ErrConcurrencyLimitReject ¶
func (c *ConsecutiveErrOpener) ErrConcurrencyLimitReject(_ context.Context, _ time.Time)
ErrConcurrencyLimitReject is ignored
func (*ConsecutiveErrOpener) ErrFailure ¶
ErrFailure increments the consecutive error counter
func (*ConsecutiveErrOpener) ErrInterrupt ¶
ErrInterrupt is ignored
func (*ConsecutiveErrOpener) ErrShortCircuit ¶
func (c *ConsecutiveErrOpener) ErrShortCircuit(_ context.Context, _ time.Time)
ErrShortCircuit is ignored
func (*ConsecutiveErrOpener) ErrTimeout ¶
ErrTimeout increments the consecutive error counter
func (*ConsecutiveErrOpener) Opened ¶
func (c *ConsecutiveErrOpener) Opened(_ context.Context, _ time.Time)
Opened resets the error counter
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 ¶
ShouldOpen returns true if enough consecutive errors have returned