backoff

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package backoff provides backoff function controller

Package backoff provides backoff function controller

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backoff

type Backoff interface {
	Do(context.Context, func(ctx context.Context) (interface{}, bool, error)) (interface{}, error)
	Close()
}

Backoff represents an interface to handle backoff operation.

func New

func New(opts ...Option) Backoff

New creates the new backoff with option.

type Option

type Option func(*backoff)

Option represents the functional option for backoff.

func WithBackOffFactor

func WithBackOffFactor(f float64) Option

WithBackOffFactor returns the option to set the factor of backoff.

func WithBackOffTimeLimit

func WithBackOffTimeLimit(dur string) Option

WithBackOffTimeLimit returns the option to set the limit of backoff.

func WithDisableErrorLog

func WithDisableErrorLog() Option

WithDisableErrorLog returns the option to set the disable for error log.

func WithEnableErrorLog

func WithEnableErrorLog() Option

WithEnableErrorLog returns the option to set the enable for error log.

func WithInitialDuration

func WithInitialDuration(dur string) Option

WithInitialDuration returns the option to set the initial duration of backoff.

func WithJitterLimit

func WithJitterLimit(dur string) Option

WithJitterLimit returns the option to set the jitter limit duration of backoff.

func WithMaximumDuration

func WithMaximumDuration(dur string) Option

WithMaximumDuration returns the option to set the maximum duration of backoff.

func WithRetryCount

func WithRetryCount(c int) Option

WithRetryCount returns the option to set the retry count of backoff.

Jump to

Keyboard shortcuts

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