token-bucket 11.2.0

Zero-dependency, lock-free atomic GCRA, Fixed-Window, Token-Bucket, and 64-way sharded bounded keyed rate-limiting engine.
Documentation
/// 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 table index and H2 tag 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;

/// Number of cache-line-isolated per-thread reader slots eliminating cross-core lock bouncing.
pub(crate) const READER_SLOT_COUNT: usize = 32;

/// Bitmask mapping thread slot counters into `0..READER_SLOT_COUNT`.
pub(crate) const READER_SLOT_MASK: usize = READER_SLOT_COUNT - 1;

/// Uninitialized sentinel for zero-overhead `const` thread-local reader slot storage.
pub(crate) const READER_SLOT_UNINIT: usize = usize::MAX;

/// Number of `spin_loop` iterations before yielding to the OS scheduler under write contention.
pub(crate) const RW_SPIN_LIMIT: u32 = 32;

/// Control tag marking an unused open-addressing slot.
pub(crate) const SLOT_EMPTY: u8 = 0;

/// Control tag marking a previously occupied deleted slot.
pub(crate) const SLOT_TOMBSTONE: u8 = 1;

/// High bit set on occupied slot tags (`0x80..=0xFF`).
pub(crate) const SLOT_OCCUPIED_BIT: u8 = 0x80;

/// Right shift extracting the 7-bit H2 fingerprint from a 64-bit key hash.
pub(crate) const SLOT_H2_SHIFT: u32 = 57;

/// Minimum power-of-two slot capacity allocated when a shard map receives its first entry.
pub(crate) const SHARD_MAP_MIN_CAP: usize = 8;