hyperlane-plugin-rate-limit 22.13.0

A 64-way sharded lock-free atomic GCRA and fixed-window rate limiter plugin for the Hyperlane framework with extensible KeyExtractor and RateLimitStore traits and RFC RateLimit headers.
Documentation
1
2
3
4
5
6
7
8
9
10
11
use super::*;

/// Thread-safe shared reference to a pluggable [`KeyExtractor`].
pub type SharedKeyExtractor = Arc<dyn KeyExtractor>;

/// Thread-safe shared reference to a pluggable [`RateLimitStore`].
pub type SharedRateLimitStore = Arc<dyn RateLimitStore>;

/// Fixed-size 64-way sharded rate-limiter entry map.
pub(crate) type RateLimitShardArray =
    Box<[RwLock<HashMapXxHash3_64<String, Arc<BucketEntry>>>; RATE_LIMIT_SHARD_COUNT]>;