Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsPermanentError ¶
IsPermanentError returns true if an error value is or contains a PermanentError in its chain of errors.
func IsTemporaryError ¶
IsTemporaryError returns true if an error value is or contains a TemporaryError in its chain of errors.
func Permanent ¶
Permanent creates a PermanentError that signals to a retry loop that it should stop retrying an operation and return the underlying error.
Types ¶
type BackoffStrategy ¶
type BackoffStrategy struct { InitialInterval int MaxInterval int Exponent float64 MaxElapsedTime int }
BackoffStrategy defines the parameters for exponential backoff. This can be used to drive a retry loop for example.
type Config ¶
type Config struct { // Strategy sets the algorithm to use for a retry loop. It can be one of: // - "backoff": retry with exponential backoff and random jitter. // - "none" or "": disables retries. Strategy string Backoff *BackoffStrategy RetryConnectionErrors bool }
Config configures a retry policy.
type PermanentError ¶
type PermanentError struct {
// contains filtered or unexported fields
}
PermanentError is an error that signals that some operation has terminally failed and should not be retried.
func (*PermanentError) Error ¶
func (e *PermanentError) Error() string
func (*PermanentError) Unwrap ¶
func (e *PermanentError) Unwrap() error
type TemporaryError ¶
type TemporaryError struct {
// contains filtered or unexported fields
}
TemporaryError represents a retryable error and signals to a retry loop that an operation may be retried with an optional wait interval.
func (*TemporaryError) Error ¶
func (e *TemporaryError) Error() string
func (*TemporaryError) RetryAfter ¶
func (e *TemporaryError) RetryAfter() time.Duration
RetryAfter returns the time to wait before retrying the request. The zero value should be interpreted by retry loops to mean they should fallback on their default policy whether expenonential, constant backoff or something else. It does not mean that an operation should be retried immediately.