apiretry

package
v0.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package apiretry provides retry utilities for Databricks API calls. It composes the generic retry machinery in core/ops with the error classification primitives in core/apierr.

This package is intended for internal use only.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTransientNetworkError

func IsTransientNetworkError(err error) bool

IsTransientNetworkError reports whether err represents a transient network condition that is likely to resolve on retry.

func NewRetrier

func NewRetrier(bp ops.BackoffPolicy, cfg RetrierConfig) ops.Retrier

NewRetrier returns a ops.Retrier configured by rules. See RetrierConfig for the matching semantics.

Important: the retrier has its own copy of the backoff policy which cannot be trivially reset by design. Users who need to reset the backoff policy should rather create a new retrier.

func RetryDurationHint

func RetryDurationHint(err error) time.Duration

RetryDurationHint returns a retry-duration hint extracted from err, if one is available. It examines, in order:

Returns 0 when err does not carry a hint.

Types

type RetrierConfig

type RetrierConfig struct {
	// ErrorCodes are canonical codes considered retriable.
	ErrorCodes []codes.Code

	// StatusCodes are HTTP status codes considered retriable. Consulted only
	// when the error does not carry a canonical code, or when ErrorCodes is
	// empty.
	StatusCodes []int
}

RetrierConfig describes which errors NewRetrier retries.

Error codes prevail over HTTP statuses. When ErrorCodes is non-empty and the error carries a canonical code that is not codes.Unknown, ErrorCodes is consulted exclusively. Otherwise the HTTP status is examined against StatusCodes.

Transient network errors are always retried regardless of rules. Retry-after hints (either passed in response header or via apierr.RetryInfo) are honored.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL