flowcontrol

package
v0.0.0-...-2e893ec Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2017 License: Apache-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 Backoff

type Backoff struct {
	sync.Mutex
	Clock util.Clock
	// contains filtered or unexported fields
}

func NewBackOff

func NewBackOff(initial, max time.Duration) *Backoff

func NewFakeBackOff

func NewFakeBackOff(initial, max time.Duration, tc *util.FakeClock) *Backoff

func (*Backoff) DeleteEntry

func (p *Backoff) DeleteEntry(id string)

func (*Backoff) GC

func (p *Backoff) GC()

Garbage collect records that have aged past maxDuration. Backoff users are expected to invoke this periodically.

func (*Backoff) Get

func (p *Backoff) Get(id string) time.Duration

Get the current backoff Duration

func (*Backoff) IsInBackOffSince

func (p *Backoff) IsInBackOffSince(id string, eventTime time.Time) bool

Returns True if the elapsed time since eventTime is smaller than the current backoff window

func (*Backoff) IsInBackOffSinceUpdate

func (p *Backoff) IsInBackOffSinceUpdate(id string, eventTime time.Time) bool

Returns True if time since lastupdate is less than the current backoff window.

func (*Backoff) Next

func (p *Backoff) Next(id string, eventTime time.Time)

move backoff to the next mark, capping at maxDuration

func (*Backoff) Reset

func (p *Backoff) Reset(id string)

Reset forces clearing of all backoff data for a given key.

Jump to

Keyboard shortcuts

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