token-bucket 11.1.0

Zero-dependency, lock-free atomic GCRA, Fixed-Window, Token-Bucket, and 64-way sharded bounded keyed rate-limiting engine.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use super::*;

/// Unified rate-limiting algorithm policy applied to every key in a `KeyedRateLimiter`.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub enum RateLimitPolicy {
    /// Generic Cell Rate Algorithm (smooth leaky-bucket arrival scheduling).
    Gcra(GcraConfig),
    /// Lock-free packed fixed-window counter.
    FixedWindow(FixedWindowConfig),
    /// Lock-free packed token bucket with discrete or smooth refill steps.
    TokenBucket(TokenBucketConfig),
}