transport

package
v2.44.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultWaitRetryInterval *time.Duration

DefaultWaitRetryInterval is used to set the retry interval to 0 during acceptance tests

View Source
var ErrRetryWhenTimeout = errors.New("timeout reached")

Functions

func NewRetryableTransport

func NewRetryableTransport(defaultTransport http.RoundTripper) http.RoundTripper

NewRetryableTransport creates a http transport with retry capability. TODO Retry logic should be moved in the SDK

func NewRetryableTransportWithOptions

func NewRetryableTransportWithOptions(defaultTransport http.RoundTripper, options RetryableTransportOptions) http.RoundTripper

func RetryOnTransientStateError

func RetryOnTransientStateError[T any, U any](action func() (T, error), waiter func() (U, error)) (T, error)

func RetryWhenAWSErrCodeEquals

func RetryWhenAWSErrCodeEquals[T any](ctx context.Context, codes []string, config *RetryWhenConfig[T]) (T, error)

RetryWhenAWSErrCodeEquals retries a function when it returns a specific AWS error

func RetryWhenAWSErrCodeNotEquals

func RetryWhenAWSErrCodeNotEquals[T any](ctx context.Context, codes []string, config *RetryWhenConfig[T]) (T, error)

RetryWhenAWSErrCodeNotEquals retries a function until it returns a specific AWS error

Types

type RetryWhenConfig

type RetryWhenConfig[T any] struct {
	Timeout  time.Duration
	Interval time.Duration
	Function func() (T, error)
}

type RetryableTransport

type RetryableTransport struct {
	*retryablehttp.Client
}

RetryableTransport client is a bridge between scw.httpClient interface and retryablehttp.Client

func (*RetryableTransport) RoundTrip

func (c *RetryableTransport) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip wraps calling an HTTP method with retries.

type RetryableTransportOptions

type RetryableTransportOptions struct {
	RetryMax     *int
	RetryWaitMax *time.Duration
	RetryWaitMin *time.Duration
}

Jump to

Keyboard shortcuts

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