package
0.0.0-20241122094317-7b2bedb1cd2f
Repository: https://github.com/sshlykov/shortener.git
Documentation: pkg.go.dev

# Functions

Float64 is a shortcut for generating a random float between 0 and 1 using crypto/rand.
Intn is a shortcut for generating a random integer between 0 and max using crypto/rand.
No description provided by the author
NewExponentialBackOff creates an instance of ExponentialBackOff using default values.
NewTicker returns a new Ticker containing a channel that will send the time at times specified by the BackOff argument.
NewTickerWithTimer returns a new Ticker with a custom timer.
Permanent wraps the given err in a *PermanentError.
Retry the operation o until it does not return error or BackOff stops.
RetryNotify calls notify function with the error and wait duration for each failed attempt before sleep.
RetryNotifyWithData is like RetryNotify but returns data in the response too.
RetryNotifyWithTimer calls notify function with the error and wait duration using the given Timer for each failed attempt before sleep.
RetryNotifyWithTimerAndData is like RetryNotifyWithTimer but returns data in the response too.
RetryWithData is like Retry but returns data in the response too.
WithClockProvider sets the clock used to measure time.
WithContext returns a BackOffContext with context ctx ctx must not be nil.
WithInitialInterval sets the initial interval between retries.
WithMaxElapsedTime sets the maximum total time for retries.
WithMaxInterval sets the maximum interval between retries.
WithMaxRetries creates a wrapper around another BackOff, which will return Stop if NextBackOff() has been called too many times since the last time Reset() was called Note: Implementation is not thread-safe.
WithMultiplier sets the multiplier for increasing the interval after each retry.
WithRandomizationFactor sets the randomization factor to add jitter to intervals.
WithRetryStopDuration sets the duration after which retries should stop.

# Constants

Default values for ExponentialBackOff.
Default values for ExponentialBackOff.
Default values for ExponentialBackOff.
Default values for ExponentialBackOff.
Default values for ExponentialBackOff.
Stop indicates that no more retries should be made for use in NextBackOff().

# Variables

SystemClock implements Clock interface that uses time.Now().

# Structs

ConstantBackOff is a backoff policy that always returns the same backoff delay.
ExponentialBackOff is a backoff implementation that increases the backoff period for each retry attempt using a randomization function that grows exponentially.
PermanentError signals that the operation should not be retried.
StopBackOff is a fixed backoff policy that always returns backoff.Stop for NextBackOff(), meaning that the operation should never be retried.
Ticker holds a channel that delivers `ticks' of a clock at times reported by a BackOff.
ZeroBackOff is a fixed backoff policy whose backoff time is always zero, meaning that the operation is retried immediately without waiting, indefinitely.

# Interfaces

BackOff is a backoff policy for retrying an operation.
BackOffContext is a backoff policy that stops retrying after the context is canceled.
Clock is an interface that returns current time for BackOff.
No description provided by the author

# Type aliases

ExponentialBackOffOpts is a function type used to configure ExponentialBackOff options.
Notify is a notify-on-error function.
An Operation is executing by Retry() or RetryNotify().
An OperationWithData is executing by RetryWithData() or RetryNotifyWithData().