This section is empty.


This section is empty.


This section is empty.


type QuotaExceededError

type QuotaExceededError struct {
	Available uint
	Requested uint

    QuotaExceededError provides the SDK error when the retries for a given token bucket have been exhausted.

    func (QuotaExceededError) Error

    func (e QuotaExceededError) Error() string

    type TokenBucket

    type TokenBucket struct {
    	// contains filtered or unexported fields

      TokenBucket provides a concurrency safe utility for adding and removing tokens from the available token bucket.

      func NewTokenBucket

      func NewTokenBucket(i uint) *TokenBucket

        NewTokenBucket returns an initialized TokenBucket with the capacity specified.

        func (*TokenBucket) Refund

        func (t *TokenBucket) Refund(amount uint)

          Refund returns the amount of tokens back to the available token bucket, up to the initial capacity.

          func (*TokenBucket) Retrieve

          func (t *TokenBucket) Retrieve(amount uint) (available uint, retrieved bool)

            Retrieve attempts to reduce the available tokens by the amount requested. If there are tokens available true will be returned along with the number of available tokens remaining. If amount requested is larger than the available capacity, false will be returned along with the available capacity. If the amount is less than the available capacity

            type TokenRateLimit

            type TokenRateLimit struct {
            	// contains filtered or unexported fields

              TokenRateLimit provides a Token Bucket RateLimiter implementation that limits the overall number of retry attempts that can be made across operation invocations.

              func NewTokenRateLimit

              func NewTokenRateLimit(tokens uint) *TokenRateLimit

                NewTokenRateLimit returns an TokenRateLimit with default values. Functional options can configure the retry rate limiter.

                func (*TokenRateLimit) AddTokens

                func (l *TokenRateLimit) AddTokens(v uint) error

                  AddTokens increments the token bucket by a fixed amount.

                  func (*TokenRateLimit) GetToken

                  func (l *TokenRateLimit) GetToken(ctx context.Context, cost uint) (func() error, error)

                    GetToken may cause a available pool of retry quota to be decremented. Will return an error if the decremented value can not be reduced from the retry quota.