pub struct Admission { /* private fields */ }Expand description
Shared admission gate handed to every per-connection task via
lifecycle::AcceptContext. Cheap to clone (just an Arc bump).
Implementations§
Source§impl Admission
impl Admission
Sourcepub fn new(active_permits: usize, queue_depth: usize) -> Self
pub fn new(active_permits: usize, queue_depth: usize) -> Self
Build an admission gate sized for active_permits + queue_depth simultaneous outstanding requests across the
daemon.
Sourcepub fn try_admit(&self) -> Result<OwnedSemaphorePermit, SubmitError>
pub fn try_admit(&self) -> Result<OwnedSemaphorePermit, SubmitError>
Attempt to admit one request. Non-blocking. The returned
OwnedSemaphorePermit must be held for the duration of the
generation; dropping it returns the slot to the pool.
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Total slots configured (active_permits + queue_depth). Diagnostic only; the wire layer doesn’t surface this.
Sourcepub fn available_permits(&self) -> usize
pub fn available_permits(&self) -> usize
Approximate count of slots currently free. Diagnostic; racy by definition (a concurrent admit can change the answer between the call and the use).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Admission
impl !RefUnwindSafe for Admission
impl Send for Admission
impl Sync for Admission
impl Unpin for Admission
impl UnsafeUnpin for Admission
impl !UnwindSafe for Admission
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more