Package-level declarations

Types

Link copied to clipboard

A counting suspendable Semaphore based implementation of a rate limiter that uses the fixed window counter-algorithm to control the number of permits available for requests. Uses fixed time windows (e.g., 1 second, 1 minute) to enforce the rate limit. At the beginning of each time window, the counter is reset, and requests are counted within that window. This implementation behaviour is dependent on the configuration provided (e.g., total permits, queue length, etc.).

Link copied to clipboard

A counting suspendable Semaphore based implementation of a rate limiter that uses the sliding window counter algorithm to control the number of permits available for requests. The sliding window counter algorithm divides the time window into smaller segments and maintains a count of requests in each segment. As time progresses, the window slides over these segments to provide a smoother rate limiting mechanism compared to fixed window counters.

Link copied to clipboard

A counting suspendable Semaphore based implementation of a rate limiter that uses the Token Bucket algorithm to control the number of permits available for requests. The Token Bucket algorithm allows for a smoother distribution of requests over time, compared to the fixed window counter algorithm. Tokens are added to the bucket at a constant rate, up to a maximum capacity, and each request consumes a certain number of tokens. If there are insufficient tokens for a request, the request is either queued or rejected based on the configuration.