Expand description
Ceiling is a simple, lightweight, and highly configurable library for handling and creating rate limiting rules.
The main entrypoint to the library is the rate_limiter!
macro found below.
Macros
group!
is a utility macro for grouping multiple values into a single keyThis macro is the entrypoint for creating rate limiting rules with ceiling.
The macro takes input corresponding to the inputs to the rate limiter and the rules.
Structs
The default store implementation if none is specified when creating a rate limiter.
The default implementation uses
dashmap::DashMap
to store buckets, sero::LockStore
to store locks,
and a std::collections::BinaryHeap
containing the expiry times for pruning expired buckets.Traits
The implementor of this trait is expected to dereference into an Option<(u32, u64)> with the items
in the tuple corresponding to the remaining requests and the reset time in seconds respectively.
While an instance of this trait is alive the corresponding rate limiting bucket is considered locked and
no changes should be made until the implementor is dropped, meaning the lock has been released.
The trait providing the required methods for a synchronous store of buckets.