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
use super::*;

/// Global monotonic counter assigning thread-local reader slot indices across threads.
pub(crate) static NEXT_READER_SLOT: AtomicUsize = AtomicUsize::new(0);

thread_local! {
    /// Per-thread cache-line-isolated reader slot index in `0..READER_SLOT_COUNT`.
    pub(crate) static THREAD_READER_SLOT: Cell<usize> = const { Cell::new(READER_SLOT_UNINIT) };
}