pub struct FdPressureGuard { /* private fields */ }Expand description
Shared fd-pressure demotion state machine.
Implementations§
Source§impl FdPressureGuard
impl FdPressureGuard
Sourcepub fn new(config: FdPressureConfig) -> Self
pub fn new(config: FdPressureConfig) -> Self
Build a guard with explicit tunables.
Sourcepub fn on_accept_error(&self, err: &Error) -> FdPressureDecision
pub fn on_accept_error(&self, err: &Error) -> FdPressureDecision
Classify one accept error. Fd-exhaustion errors demote the broker; anything else is reported back to the caller as unrelated.
Sourcepub fn on_accept_ok(&self) -> bool
pub fn on_accept_ok(&self) -> bool
Record one successful accept. Returns true when this accept
cleared an active demotion.
Sourcepub fn is_demoted(&self) -> bool
pub fn is_demoted(&self) -> bool
Whether new Hello connections are currently being refused.
Sourcepub fn demotions_total(&self) -> u64
pub fn demotions_total(&self) -> u64
Total demotion episodes since the guard was created.
Sourcepub fn refused_while_demoted(&self) -> u64
pub fn refused_while_demoted(&self) -> u64
Hello connections refused with ERROR_FD_PRESSURE so far.
Sourcepub fn refusal_reply(&self) -> HelloReply
pub fn refusal_reply(&self) -> HelloReply
Structured refusal sent to Hello clients while demoted.
Sourcepub fn force_demote(&self)
pub fn force_demote(&self)
Force a demotion without an accept error (tests / external probes).
Trait Implementations§
Source§impl Debug for FdPressureGuard
impl Debug for FdPressureGuard
Source§impl Default for FdPressureGuard
impl Default for FdPressureGuard
Source§fn default() -> FdPressureGuard
fn default() -> FdPressureGuard
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for FdPressureGuard
impl RefUnwindSafe for FdPressureGuard
impl Send for FdPressureGuard
impl Sync for FdPressureGuard
impl Unpin for FdPressureGuard
impl UnsafeUnpin for FdPressureGuard
impl UnwindSafe for FdPressureGuard
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more