pub struct AdmissionLease {
owner: Option<Arc<dyn AdmissionRelease>>,
slot: usize,
}Expand description
Proof that a request is being served by a resident model, and that the runtime must not evict that model until the request is done.
Dropping the lease releases the slot. Every exit path a request has — normal
completion, ?, client disconnect, panic unwind — runs Drop, so there is
no path that leaks a reference and wedges the scheduler. This is the same
guarantee, for the same reason, that the proxy’s connection registry gets
from its own guard.
Not Clone: two owners would mean two releases for one acquisition.
Fields§
§owner: Option<Arc<dyn AdmissionRelease>>§slot: usizeImplementations§
Source§impl AdmissionLease
impl AdmissionLease
Sourcepub fn new(owner: Arc<dyn AdmissionRelease>, slot: usize) -> Self
pub fn new(owner: Arc<dyn AdmissionRelease>, slot: usize) -> Self
Create a lease that releases slot on owner when dropped.
Sourcepub const fn detached() -> Self
pub const fn detached() -> Self
A lease that owns nothing and releases nothing.
For runtimes with no resident set to account for — test doubles and the
NoopModelRuntime — so they are not forced to implement a scheduler
to satisfy the signature.