pub struct BackpressureGate { /* private fields */ }Expand description
Backpressure gate — tracks active sessions and enforces the limit.
Implementations§
Source§impl BackpressureGate
impl BackpressureGate
Sourcepub fn new(config: BackpressureConfig) -> Self
pub fn new(config: BackpressureConfig) -> Self
Create a new gate with the given configuration.
Sourcepub fn active_count(&self) -> usize
pub fn active_count(&self) -> usize
Current active session count.
Sourcepub fn max_sessions(&self) -> usize
pub fn max_sessions(&self) -> usize
Maximum allowed sessions.
Sourcepub fn try_acquire(&self) -> Result<ActiveSlot<'_>, BackpressureError>
pub fn try_acquire(&self) -> Result<ActiveSlot<'_>, BackpressureError>
Try to acquire a slot. Returns Ok(()) if a slot was acquired
(active count incremented), or Err(AtCapacity) if the
coordinator is full.
Sourcepub fn is_at_capacity(&self) -> bool
pub fn is_at_capacity(&self) -> bool
Is the coordinator at capacity?
Auto Trait Implementations§
impl !Freeze for BackpressureGate
impl RefUnwindSafe for BackpressureGate
impl Send for BackpressureGate
impl Sync for BackpressureGate
impl Unpin for BackpressureGate
impl UnsafeUnpin for BackpressureGate
impl UnwindSafe for BackpressureGate
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