retry

package
v0.2.47 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package retry provides the most advanced interruptible mechanism to perform actions repetitively until successful.

Index

Constants

This section is empty.

Variables

View Source
var (
	Err      = xerror.NewXErr("Retry")
	ErrRetry = Err.New("retry error")
)

Functions

func At added in v0.2.47

func At(t time.Duration, fn func(i int))

At xerror

func Do

func Do(
	breaker strategy.Breaker,
	action func() error,
	strategies ...func(strategy.Breaker, uint, error) bool,
) error

Do takes an action and performs it, repetitively, until successful.

Optionally, strategies may be passed that assess whether or not an attempt should be made.

func DoAsync

func DoAsync(
	breaker strategy.Breaker,
	action func() error,
	strategies ...func(strategy.Breaker, uint, error) bool,
) error

DoAsync takes an action and performs it, repetitively, until successful.

Optionally, strategies may be passed that assess whether or not an attempt should be made.

func Retry

func Retry(num int, fn func(i int)) (err error)

Retry xerror

func Ticker

func Ticker(fn func(i int) time.Duration)

Ticker xerror

Types

type Action

type Action func() error

Action defines a callable function that package retry can handle.

type How

type How []func(strategy.Breaker, uint, error) bool

How is an alias for batch of Strategies.

how := retry.How{
	strategy.Limit(3),
}

type IRetry added in v0.2.47

type IRetry interface {
	Ticker(fn func(i int) bool, strategy ...interface{})
	Fibonacci()
	At(t time.Duration, fn func(i int))
	Retry(num int, fn func(i int)) (err error)
	Do()
}

Directories

Path Synopsis
Package backoff provides stateless methods of calculating durations based on a number of attempts made.
Package backoff provides stateless methods of calculating durations based on a number of attempts made.
Package jitter provides methods of transforming durations.
Package jitter provides methods of transforming durations.
Package strategy provides a way to define how retry is performed.
Package strategy provides a way to define how retry is performed.

Jump to

Keyboard shortcuts

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