Struct: ratelimit.TokenRateLimit
Overview
TokenRateLimit provides a Token Bucket RateLimiter implementation that limits the overall number of retry attempts that can be made across operation invocations.
Implemented Interfaces
types.AnalyticsFilter, v4.HTTPPresigner, s3.HTTPPresignerV4, types.MetricsFilter, s3.PresignPost, retry.RateLimiter, arn.S3ObjectLambdaARN, types.SelectObjectContentEventStream
Constructor Functions collapse
-
func NewTokenRateLimit(tokens uint) *TokenRateLimit
NewTokenRateLimit returns an TokenRateLimit with default values.
Method Summary collapse
-
func (l *TokenRateLimit) AddTokens(v uint) error
AddTokens increments the token bucket by a fixed amount.
-
func (l *TokenRateLimit) GetToken(ctx context.Context, cost uint) (func() error, error)
GetToken may cause a available pool of retry quota to be decremented.
-
func (l *TokenRateLimit) Remaining() uint
Remaining returns the number of remaining tokens in the bucket.
Function Details
func NewTokenRateLimit(tokens uint) *TokenRateLimit
NewTokenRateLimit returns an TokenRateLimit with default values. Functional options can configure the retry rate limiter.
26 27 28 29 30 |
// File 'aws/ratelimit/token_rate_limit.go', line 26
|
Method Details
func (l *TokenRateLimit) AddTokens(v uint) error
AddTokens increments the token bucket by a fixed amount.
62 63 64 65 |
// File 'aws/ratelimit/token_rate_limit.go', line 62
|
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.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
// File 'aws/ratelimit/token_rate_limit.go', line 45
|
func (l *TokenRateLimit) Remaining() uint
Remaining returns the number of remaining tokens in the bucket.
68 69 70 |
// File 'aws/ratelimit/token_rate_limit.go', line 68
|