token-bucket 10.11.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
/// Number of cache-line-aligned shards in `KeyedRateLimiter`.
pub const KEYED_SHARD_COUNT: usize = 64;

/// Bitmask mapping shifted hash bits to a shard index in `0..64`.
pub(crate) const KEYED_SHARD_MASK: usize = KEYED_SHARD_COUNT - 1;

/// Bit shift selecting shard bits independent of SwissTable H1/H2 hash bits.
pub(crate) const KEYED_SHARD_SHIFT: u32 = 50;

/// Secondary mixing salt combined with instance address to seed per-limiter hashing.
pub(crate) const SEED_MIX_SALT: u64 = 0x517C_C1B7_2722_0A95;