Documentation ¶
Overview ¶
Package retry provides functional mechanism based on channels to perform actions repetitively until successful.
This package is an extended version of https://godoc.org/github.com/Rican7/retry. Copyright © 2016 Trevor N. Suarez (Rican7)
Index ¶
- func IsRecovered(err error) (interface{}, bool)
- func IsTimeout(err error) bool
- func Multiplex(channels ...<-chan struct{}) <-chan struct{}
- func Retry(deadline <-chan struct{}, action Action, strategies ...strategy.Strategy) error
- func WithContext(parent context.Context, deadline <-chan struct{}) context.Context
- func WithDeadline(deadline time.Time) <-chan struct{}
- func WithSignal(s os.Signal) <-chan struct{}
- func WithTimeout(timeout time.Duration) <-chan struct{}
- type Action
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRecovered ¶
IsRecovered checks that the error is related to unhandled Action's panic and returns an original cause of panic.
func Multiplex ¶
func Multiplex(channels ...<-chan struct{}) <-chan struct{}
Multiplex combines multiple empty struct channels into one. TODO can be leaky, https://github.com/kamilsk/retry/issues/109
func Retry ¶
Retry 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 WithContext ¶
WithContext returns Context with cancellation based on empty struct channel.
func WithDeadline ¶
WithDeadline returns empty struct channel above on `time.Timer` channel. TODO can be leaky, https://github.com/kamilsk/retry/issues/109
func WithSignal ¶
WithSignal returns empty struct channel above on `os.Signal` channel. TODO can be leaky, https://github.com/kamilsk/retry/issues/109
func WithTimeout ¶
WithTimeout returns empty struct channel above on `time.Timer` channel. TODO can be leaky, https://github.com/kamilsk/retry/issues/109
Types ¶
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 classifier provides a way to classify an occurred error.
|
Package classifier provides a way to classify an occurred error. |
cmd
|
|
examples
module
|
|
Package jitter provides methods of transforming durations.
|
Package jitter provides methods of transforming durations. |
sandbox
module
|
|
Package strategy provides a way to change the way that retry is performed.
|
Package strategy provides a way to change the way that retry is performed. |