rate

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

type Limiter interface {
	// Limit applies rate limiting to the given request. This method
	// should block if necessary to maintain the desired request rate.
	// The implementation can use the request information (method, path, etc.)
	// to apply different rate limits for different endpoints.
	Limit(req *http.Request)
}

Limiter controls request rates to the Iterable API.

The Limiter interface provides rate limiting functionality to prevent exceeding Iterable's API rate limits. Implementations can use different strategies such as:

  • Token bucket algorithm
  • Fixed window counting
  • Sliding window counting
  • Leaky bucket algorithm

Example usage:

type TokenBucketLimiter struct {
    rate  float64
    burst int
}

func (l *TokenBucketLimiter) Limit(req *http.Request) {
    // Apply rate limiting logic before allowing request
}

The Limit method is called before each request to potentially delay or throttle the request based on the current rate limiting state. This helps maintain good API citizenship and prevents rate limit errors.

type NoopLimiter

type NoopLimiter struct {
}

func (NoopLimiter) Limit

func (n NoopLimiter) Limit(_ *http.Request)

Jump to

Keyboard shortcuts

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