backoff

package
v1.2.2 Latest Latest
Warning

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

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

Documentation

Overview

Package backoff is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backoff

type Backoff interface {
	// Backoff waits and blocks the caller for a duration of time depending on the number of attempts,
	// or until the context is done.
	Backoff(ctx context.Context, attempts int)
}

Backoff is the interface for backoff.

type Exponential

type Exponential struct {
	BaseBackoff time.Duration // Base backoff duration
	MaxBackoff  time.Duration // Maximum backoff duration
}

Exponential implements a backoff strategy that increases the backoff duration exponentially, up to a maximum backoff duration.

func NewExponential

func NewExponential(baseBackoff, maxBackoff time.Duration) *Exponential

func (*Exponential) Backoff

func (eb *Exponential) Backoff(ctx context.Context, attempts int)

type MockBackoff

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

MockBackoff is a mock of Backoff interface.

func NewMockBackoff

func NewMockBackoff(ctrl *gomock.Controller) *MockBackoff

NewMockBackoff creates a new mock instance.

func (*MockBackoff) Backoff

func (m *MockBackoff) Backoff(ctx context.Context, attempts int)

Backoff mocks base method.

func (*MockBackoff) EXPECT

func (m *MockBackoff) EXPECT() *MockBackoffMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

type MockBackoffMockRecorder

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

MockBackoffMockRecorder is the mock recorder for MockBackoff.

func (*MockBackoffMockRecorder) Backoff

func (mr *MockBackoffMockRecorder) Backoff(ctx, attempts any) *gomock.Call

Backoff indicates an expected call of Backoff.

type Noop

type Noop struct {
}

Noop implements a backoff strategy that does NOT backoff regardless of the number of attempts.

func NewNoop

func NewNoop() *Noop

func (*Noop) Backoff

func (b *Noop) Backoff(ctx context.Context, attempts int)

Jump to

Keyboard shortcuts

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