runlimit_memory/lib.rs
1//! Hard-bounded, process-local rate-limit storage.
2//!
3//! [`MemoryStore`] implements the same anchored fixed-window model as the
4//! `PostgreSQL` backend. [`GcraStore`] implements a continuously replenished
5//! generic-cell-rate-algorithm model for process-local use. Both stores
6//! deliberately refuse to evict live entries. When a shard is full, a new
7//! subject is denied until bounded cleanup frees space. An atomic batch that
8//! can never fit in one shard returns a structural [`MemoryStoreError`] (wrapped
9//! by [`GcraStoreError`] for GCRA admission) instead of a retryable capacity
10//! denial. Both stores implement
11//! [`runlimit_core::Limiter`] for async generic adapters while retaining their
12//! synchronous inherent check methods.
13//!
14//! The optional `serde` feature enables validated [`MemoryStoreConfig`]
15//! loading, read-only [`MemoryStoreStats`] serialization, and the corresponding
16//! `runlimit-core` metadata feature.
17
18mod clock;
19mod config;
20mod gcra;
21mod shards;
22mod store;
23
24pub use clock::{Clock, SystemClock};
25pub use config::{MemoryStoreConfig, MemoryStoreConfigError};
26pub use gcra::{GcraStore, GcraStoreError};
27pub use store::{MemoryStore, MemoryStoreError, MemoryStoreStats};