Documentation
¶
Index ¶
- type ErrorCallback
- type Retry
- type RetryCancelError
- type RetryError
- type RetryErrorScope
- type Retryable
- type Retryer
- type RetryerOptsFunc
- func WithErrorCallback(c ErrorCallback) RetryerOptsFunc
- func WithLoggingOnAttemptError(severity logrus.Level) RetryerOptsFunc
- func WithMaxAttempts(maxAttempts int) RetryerOptsFunc
- func WithMaxDuration(duration time.Duration) RetryerOptsFunc
- func WithWaitDuration(duration time.Duration) RetryerOptsFunc
- func WithoutMaxAttempts() RetryerOptsFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorCallback ¶
type RetryCancelError ¶
type RetryCancelError struct {
// contains filtered or unexported fields
}
RetryCancelError is a error wrapping type that the user of a Retry should use to cancel retry operations before the end of maxAttempts/maxDuration conditions
func NewRetryCancelError ¶
func NewRetryCancelError(err error) RetryCancelError
func (RetryCancelError) Error ¶
func (err RetryCancelError) Error() string
type RetryError ¶
type RetryError struct { Scope RetryErrorScope Err error LastErr error }
func (RetryError) Error ¶
func (err RetryError) Error() string
type RetryErrorScope ¶
type RetryErrorScope string
const ( MaxDurationScope RetryErrorScope = "max-duration" ContextScope RetryErrorScope = "context" )
type Retryer ¶
type Retryer struct {
// contains filtered or unexported fields
}
func New ¶
func New(opts ...RetryerOptsFunc) Retryer
type RetryerOptsFunc ¶
type RetryerOptsFunc func(r *Retryer)
func WithErrorCallback ¶
func WithErrorCallback(c ErrorCallback) RetryerOptsFunc
func WithLoggingOnAttemptError ¶ added in v1.2.2
func WithLoggingOnAttemptError(severity logrus.Level) RetryerOptsFunc
WithLoggingOnAttemptError allows emitting a log message on each attempt which failed. The capacity to specify the severity of the log message is useful to avoid flooding the logs with too many messages in case of a retry loop. Most of the time it will be Debug or Info according to the type of operation. Error should be chosen carefully if logger was configured to send Errors to a tool like Rollbar/Sentry/...
func WithMaxAttempts ¶
func WithMaxAttempts(maxAttempts int) RetryerOptsFunc
func WithMaxDuration ¶
func WithMaxDuration(duration time.Duration) RetryerOptsFunc
func WithWaitDuration ¶
func WithWaitDuration(duration time.Duration) RetryerOptsFunc
func WithoutMaxAttempts ¶
func WithoutMaxAttempts() RetryerOptsFunc
Click to show internal directories.
Click to hide internal directories.