retry

package
v0.0.0-...-65b1d8a Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2014 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnlimitedDeadline time.Duration = time.Duration(math.MaxInt64)
	UnlimitedDelay                  = time.Duration(math.MaxInt64)
)

Variables

View Source
var (
	ForceRetryError  error = errors.New("force to retry")
	RetryFailedError       = errors.New("retry failed")
)

Functions

func Min

func Min(a, b int64) int64

func RandIntN

func RandIntN(n int) int

Types

type BoundedExponentialBackoffRetry

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

func NewBoundedExponentialBackoffRetry

func NewBoundedExponentialBackoffRetry(
	sleepFunc func(time.Duration),
	maxTries uint32,
	baseSleepTime time.Duration,
	maxSleepTime time.Duration) *BoundedExponentialBackoffRetry

func (*BoundedExponentialBackoffRetry) Do

func (self *BoundedExponentialBackoffRetry) Do(fn func() error) error

type ErrorRetry

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

func NewErrorRetry

func NewErrorRetry() *ErrorRetry

func (*ErrorRetry) Backoff

func (self *ErrorRetry) Backoff(backoff uint32) *ErrorRetry

func (*ErrorRetry) Copy

func (self *ErrorRetry) Copy() *ErrorRetry

func (*ErrorRetry) Deadline

func (self *ErrorRetry) Deadline(deadline time.Duration) *ErrorRetry

func (*ErrorRetry) Delay

func (self *ErrorRetry) Delay(delay time.Duration) *ErrorRetry

func (*ErrorRetry) Do

func (self *ErrorRetry) Do(fn func() error) error

func (*ErrorRetry) MaxDelay

func (self *ErrorRetry) MaxDelay(maxDelay time.Duration) *ErrorRetry

func (*ErrorRetry) MaxJitter

func (self *ErrorRetry) MaxJitter(maxJitter float32) *ErrorRetry

func (*ErrorRetry) MaxTries

func (self *ErrorRetry) MaxTries(maxTries int) *ErrorRetry

func (*ErrorRetry) OnError

func (self *ErrorRetry) OnError(err error) *ErrorRetry

func (*ErrorRetry) SleepFunc

func (self *ErrorRetry) SleepFunc(fn func(time.Duration)) *ErrorRetry

type ExponentialBackoffRetry

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

func NewExponentialBackoffRetry

func NewExponentialBackoffRetry(
	sleepFunc func(time.Duration),
	baseSleepTime time.Duration,
	maxSleepTime time.Duration) *ExponentialBackoffRetry

func (*ExponentialBackoffRetry) Do

func (self *ExponentialBackoffRetry) Do(fn func() error) error

type NTimesRetry

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

func NewNTimesRetry

func NewNTimesRetry(
	sleepFunc func(time.Duration),
	maxTimes uint32,
	sleepTimeBetweenRetries time.Duration) *NTimesRetry

func (*NTimesRetry) Do

func (self *NTimesRetry) Do(fn func() error) error

type OnceRetry

type OnceRetry struct {
	*NTimesRetry
}

func NewOnceRetry

func NewOnceRetry(
	sleepFunc func(time.Duration),
	sleepTimeBetweenRetries time.Duration) *OnceRetry

type Retry

type Retry interface {
	Do(func() error) error
}

type UntilElapsedRetry

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

func NewUntilElapsedRetry

func NewUntilElapsedRetry(
	sleepFunc func(time.Duration),
	sleepTimeBetweenRetries time.Duration,
	maxElapsedTime time.Duration) *UntilElapsedRetry

func (*UntilElapsedRetry) Do

func (self *UntilElapsedRetry) Do(fn func() error) error

Jump to

Keyboard shortcuts

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