package retry
import "github.com/ydb-platform/ydb-go-sdk/v3/retry"
Index ¶
- Constants
- Variables
- func Check(err error) (m retryMode)
- func IsOperationIdempotent(ctx context.Context) bool
- func Retry(ctx context.Context, isIdempotentOperation bool, op retryOperation) (err error)
- func RetryableError(err error, opts ...retryableErrorOption) error
- func Wait(ctx context.Context, fastBackoff Backoff, slowBackoff Backoff, m retryMode, i int) error
- func WithBackoff(t errors.BackoffType) retryableErrorOption
- func WithDeleteSession() retryableErrorOption
- func WithIdempotentOperation(ctx context.Context) context.Context
- func WithNonIdempotentOperation(ctx context.Context) context.Context
- type Backoff
Constants ¶
const ( BackoffTypeNoBackoff = errors.BackoffTypeNoBackoff BackoffTypeFastBackoff = errors.BackoffTypeFastBackoff BackoffTypeSlowBackoff = errors.BackoffTypeSlowBackoff )
Variables ¶
var ( FastBackoff = logBackoff{ SlotDuration: fastSlot, Ceiling: 6, } SlowBackoff = logBackoff{ SlotDuration: slowSlot, Ceiling: 6, } )
Default parameters used by Retry() functions within different sub packages.
Functions ¶
func Check ¶
func Check(err error) (m retryMode)
Check returns retry mode for err.
func IsOperationIdempotent ¶
IsOperationIdempotent returns the flag for retry with no idempotent errors
func Retry ¶
Retry provide the best effort fo retrying operation Retry implements internal busy loop until one of the following conditions is met: - deadline was canceled or deadlined - retry operation returned nil as error Warning: if deadline without deadline or cancellation func Retry will be worked infinite If you need to retry your op func on some logic errors - you must returns from op func RetryableError()
func RetryableError ¶
func Wait ¶
func WithBackoff ¶
func WithBackoff(t errors.BackoffType) retryableErrorOption
func WithDeleteSession ¶
func WithDeleteSession() retryableErrorOption
func WithIdempotentOperation ¶
WithIdempotentOperation returns a copy of parent context with idempotent operation feature
func WithNonIdempotentOperation ¶
WithNonIdempotentOperation returns a copy of parent context with non-idempotent operation feature
Types ¶
type Backoff ¶
type Backoff interface { // Wait maps index of the retry to a channel which fulfillment means that // delay is over. // // Note that retry index begins from 0 and 0-th index means that it is the // first retry attempt after an initial error. Wait(n int) <-chan time.Time }
Backoff is the interface that contains logic of delaying operation retry.
Source Files ¶
- Version
- v3.7.1
- Published
- Jan 17, 2022
- Platform
- linux/amd64
- Imports
- 6 packages
- Last checked
- 26 minutes ago –
Tools for package owners.