policy

package
v2.0.0-...-5e4c55b Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxRetries    = 3
	DefaultMaxRetryDelay = math.MaxInt64
	DefaultRetryDelay    = 800 * time.Millisecond
	DefaultTryTimeout    = 5 * time.Second
)
View Source
const HeaderRetryAfter = "Retry-After"

Variables

This section is empty.

Functions

func GetRetriableStatusCode

func GetRetriableStatusCode() []int

func NewGetRequestRegionalEndpointRetryPolicy

func NewGetRequestRegionalEndpointRetryPolicy(regionalEndpoint string) policy.Policy

func NewRateLimitPolicy

func NewRateLimitPolicy(config *RateLimitConfig) policy.Policy

func NewThrottlingPolicy

func NewThrottlingPolicy() policy.Policy

Types

type GetRequestRegionalEndpointRetryPolicy

type GetRequestRegionalEndpointRetryPolicy struct {
	// contains filtered or unexported fields
}

GetRequestRegionalEndpointRetryPolicy is a policy that retries requests on ResourceGroupNotFound error.

func (*GetRequestRegionalEndpointRetryPolicy) Do

type RateLimitConfig

type RateLimitConfig struct {
	// Enable rate limiting
	CloudProviderRateLimit bool `json:"cloudProviderRateLimit,omitempty" yaml:"cloudProviderRateLimit,omitempty"`
	// Rate limit QPS (Read)
	CloudProviderRateLimitQPS float32 `json:"cloudProviderRateLimitQPS,omitempty" yaml:"cloudProviderRateLimitQPS,omitempty"`
	// Rate limit Bucket Size
	CloudProviderRateLimitBucket int `json:"cloudProviderRateLimitBucket,omitempty" yaml:"cloudProviderRateLimitBucket,omitempty"`
	// Rate limit QPS (Write)
	CloudProviderRateLimitQPSWrite float32 `json:"cloudProviderRateLimitQPSWrite,omitempty" yaml:"cloudProviderRateLimitQPSWrite,omitempty"`
	// Rate limit Bucket Size
	CloudProviderRateLimitBucketWrite int `json:"cloudProviderRateLimitBucketWrite,omitempty" yaml:"cloudProviderRateLimitBucketWrite,omitempty"`
}

RateLimitConfig indicates the rate limit config options.

type RateLimitPolicy

type RateLimitPolicy struct {
	// contains filtered or unexported fields
}

func (RateLimitPolicy) Do

type RetryConfig

type RetryConfig struct {
	PollingDelay  *time.Duration
	RetryAttempts *int

	RetryDuration *time.Duration
	// Backoff holds parameters applied to a Backoff function.
	// The initial duration.
	Duration time.Duration
	// Duration is multiplied by factor each iteration, if factor is not zero
	// and the limits imposed by Steps and Cap have not been reached.
	// Should not be negative.
	// The jitter does not contribute to the updates to the duration parameter.
	Factor float64
	// The sleep at each iteration is the duration plus an additional
	// amount chosen uniformly at random from the interval between
	// zero and `jitter*duration`.
	Jitter float64
	// The remaining number of iterations in which the duration
	// parameter may change (but progress can be stopped earlier by
	// hitting the cap). If not positive, the duration is not
	// changed. Used for exponential backoff in combination with
	// Factor and Cap.
	Steps int
	// A limit on revised values of the duration parameter. If a
	// multiplication by the factor parameter would make the duration
	// exceed the cap then the duration is set to the cap and the
	// steps parameter is set to zero.
	Cap time.Duration
	// The errors indicate that the request shouldn't do more retrying.
	NonRetriableErrors []string
	// The RetriableHTTPStatusCodes indicates that the HTTPStatusCode should do more retrying.
	RetriableHTTPStatusCodes []int
}

type ThrottlingPolicy

type ThrottlingPolicy struct {
	RetryAfterReader time.Time
	RetryAfterWriter time.Time
}

ThrottlingPolicy implements the Azure SDK for Go's Policy interface. throttle counter is based on resources operation per subscription.

func (*ThrottlingPolicy) Do

Jump to

Keyboard shortcuts

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