Skip to main content

Crate runlimit_core

Crate runlimit_core 

Source
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.
CounterKey
The complete logical identity of one stored rate-limit counter.
Decision
The outcome of evaluating one check.
FixedWindowPolicy
An anchored fixed-window rate-limit policy.
KeyHasher
Derives opaque subject keys using HMAC-SHA-256.
PolicyFingerprint
A deterministic digest of a policy’s identity, scope, and configuration.
PolicyId
A stable application-defined rate-limit policy identifier.
ScopeId
A stable application-defined scope within a rate-limit policy.
SubjectKey
An opaque, fixed-width subject identifier used by storage backends.

Enums§

BatchDecision
The atomic outcome of evaluating checks in caller-supplied order.
BatchError
A backend-independent invalid atomic batch.
CheckError
An invalid check cost.
Denial
Structured details for a denied check.
IdentifierError
An invalid policy or scope identifier.
KeyHasherError
An invalid subject-key hasher configuration.
PolicyError
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.