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) // BackoffDuration returns the duration that would be used for the given number of attempts // without actually performing the wait. BackoffDuration(attempts int) time.Duration }
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) BackoffDuration ¶ added in v1.5.2
func (eb *Exponential) BackoffDuration(attempts int) time.Duration
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) BackoffDuration ¶ added in v1.5.2
func (m *MockBackoff) BackoffDuration(attempts int) time.Duration
BackoffDuration 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 interface{}) *gomock.Call
Backoff indicates an expected call of Backoff.
func (*MockBackoffMockRecorder) BackoffDuration ¶ added in v1.5.2
func (mr *MockBackoffMockRecorder) BackoffDuration(attempts interface{}) *gomock.Call
BackoffDuration indicates an expected call of BackoffDuration.
Click to show internal directories.
Click to hide internal directories.