#[non_exhaustive]pub enum Denial {
QuotaExceeded {
capacity: u64,
retry_after: Duration,
},
StorageCapacity {
retry_after: Option<Duration>,
},
}Expand description
Structured details for a denied check.
A quota denial always contains its policy capacity and the duration until the requested cost can be retried. A storage-capacity denial may contain the duration until the backend’s earliest known expiry, when one is available.
Process-local backends can measure the duration at evaluation time exactly. Distributed backends may return a safe upper bound measured with their authoritative clock, which can overstate the duration at the caller by commit and transport time.
With the serde feature, this is an object tagged by reason. Durations
use Serde’s exact { "secs": ..., "nanos": ... } representation.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
QuotaExceeded
Consuming the requested cost would exceed the configured quota.
Fields
StorageCapacity
A bounded backend could not safely allocate storage for a new key.
Implementations§
Source§impl Denial
impl Denial
Sourcepub const fn retry_after(&self) -> Option<Duration>
pub const fn retry_after(&self) -> Option<Duration>
Returns the backend-reported duration after which the caller may retry, if known.
Sourcepub const fn retry_after_seconds(&self) -> Option<u64>
pub const fn retry_after_seconds(&self) -> Option<u64>
Returns a whole-second Retry-After value rounded up, if known.
The underlying Duration remains available through
Denial::retry_after. Values beyond the representable range saturate
at u64::MAX.
Trait Implementations§
impl Copy for Denial
Source§impl<'de> Deserialize<'de> for Denial
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Denial
serde only.