pub struct DeviceLease {
pub kind: DeviceLeaseKind,
pub max_concurrent: Option<u32>,
pub refresh_secs: u32,
}Expand description
Rate-limit lease contract for PrincipalKind::Device principals.
Carries the information distributed-ratelimit needs to implement the
Device floor in PrincipalKindPolicy without re-deriving semantics.
§Refresh bound
refresh is the hardware-attestation renewal cadence and sets the upper
bound on the rate-limit TTL floor for this device. It must not exceed
3 600 seconds (1 h), consistent with the Agent credential hard-cap in
platform ADR 0012. The definitive value will be pinned when quorumauth#25
(Device/Agent attestation split) settles; until then callers should treat
3 600 s as the ceiling.
Fields§
§kind: DeviceLeaseKindWhether to track this device as a connection gauge or a request counter.
max_concurrent: Option<u32>Maximum concurrent connections (Connection kind) or maximum burst
requests per window (RequestStream kind). None means no
device-specific cap; the extractor falls back to the global default.
refresh_secs: u32Hardware-attestation refresh cadence. Sets the upper bound on the rate-limit TTL floor. Must not exceed 3 600 s (see doc comment).
Implementations§
Source§impl DeviceLease
impl DeviceLease
Sourcepub const MAX_REFRESH_SECS: u32 = 3_600
pub const MAX_REFRESH_SECS: u32 = 3_600
Maximum permitted refresh_secs value (1 h, matching platform ADR
0012 Agent credential hard-cap and acting as a proxy for the
quorumauth#25 attestation cadence until that ADR settles).
Sourcepub fn new(
kind: DeviceLeaseKind,
max_concurrent: Option<u32>,
refresh_secs: u32,
) -> Self
pub fn new( kind: DeviceLeaseKind, max_concurrent: Option<u32>, refresh_secs: u32, ) -> Self
Construct a DeviceLease, clamping refresh_secs to
Self::MAX_REFRESH_SECS.
§Examples
use api_bones::{DeviceLease, DeviceLeaseKind};
// Connection-count gauge, max 10 simultaneous, 15-minute refresh.
let lease = DeviceLease::new(DeviceLeaseKind::Connection, Some(10), 900);
assert_eq!(lease.refresh_secs, 900);
// Refresh value is clamped to MAX_REFRESH_SECS (3 600 s).
let capped = DeviceLease::new(DeviceLeaseKind::RequestStream, None, 99_999);
assert_eq!(capped.refresh_secs, DeviceLease::MAX_REFRESH_SECS);Trait Implementations§
Source§impl Clone for DeviceLease
impl Clone for DeviceLease
Source§fn clone(&self) -> DeviceLease
fn clone(&self) -> DeviceLease
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more