pub struct FdBudget { /* private fields */ }Expand description
Shared fd permit pool used by PlainPbStoragePlugin. Cloning
the budget hands the SAME counter to multiple plugins, so a
process-wide cap can be enforced across STS/MTS/LTS instead of
each tier privately keeping its own 512-fd ceiling and silently
summing past the process ulimit.
Internally a Arc<AtomicUsize> plus a max. CAS-based
reservation in try_reserve makes the cap a hard ceiling under
concurrency (no check-then-fetch_add race).
Implementations§
Source§impl FdBudget
impl FdBudget
Sourcepub fn new(max: usize) -> Self
pub fn new(max: usize) -> Self
New budget with the given cap. 0 is sentinel for
“unbounded” (lifts the cap to usize::MAX); any other value
is the hard ceiling.
Sourcepub fn unbounded() -> Self
pub fn unbounded() -> Self
Convenience constructor for sites that want to disable the internal cap entirely (e.g. when the OS ulimit alone is the only ceiling that matters).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FdBudget
impl RefUnwindSafe for FdBudget
impl Send for FdBudget
impl Sync for FdBudget
impl Unpin for FdBudget
impl UnsafeUnpin for FdBudget
impl UnwindSafe for FdBudget
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