Expand description
Framework-neutral contracts shared by Runlimit storage backends.
This crate defines anchored fixed-window policies, opaque subject keys, checks, and backend-independent decisions. It deliberately contains no async runtime, transport framework, or persistence integration.
Applications own subject normalization and policy selection. Raw subjects
should be converted to SubjectKey values with KeyHasher before they
cross into a storage backend.
Structs§
- Check
- One proposed quota charge against a policy and opaque subject.
- Counter
Key - The complete logical identity of one stored rate-limit counter.
- Decision
- The outcome of evaluating one check.
- Fixed
Window Policy - An anchored fixed-window rate-limit policy.
- KeyHasher
- Derives opaque subject keys using HMAC-SHA-256.
- Policy
Fingerprint - A deterministic digest of a policy’s identity, scope, and configuration.
- Policy
Id - A stable application-defined rate-limit policy identifier.
- ScopeId
- A stable application-defined scope within a rate-limit policy.
- Subject
Key - An opaque, fixed-width subject identifier used by storage backends.
Enums§
- Batch
Decision - The atomic outcome of evaluating checks in caller-supplied order.
- Batch
Error - A backend-independent invalid atomic batch.
- Check
Error - An invalid check cost.
- Denial
- Structured details for a denied check.
- Identifier
Error - An invalid policy or scope identifier.
- KeyHasher
Error - An invalid subject-key hasher configuration.
- Policy
Error - An invalid fixed-window policy configuration.
Constants§
- MAX_
IDENTIFIER_ LENGTH - Maximum encoded length of a policy or scope identifier.
- MAX_
LIMIT - Largest fixed-window quota supported by every Runlimit backend.
- MAX_
WINDOW - Largest fixed-window duration supported by every Runlimit backend.
- MAX_
WINDOW_ MILLIS - Largest whole-millisecond window supported by every Runlimit backend.
Functions§
- validate_
batch - Validates backend-independent structural requirements for an atomic batch.