pub struct Budget { /* private fields */ }Expand description
A memory budget for a single engine.
Tracks current allocation against a configurable limit using atomic counters (safe to read from any thread — metrics exporter, governor, etc.).
Implementations§
Source§impl Budget
impl Budget
Sourcepub fn try_reserve(&self, size: usize) -> bool
pub fn try_reserve(&self, size: usize) -> bool
Try to reserve size bytes from this budget.
Returns true if the reservation succeeded, false if it would
exceed the limit.
Sourcepub fn release(&self, size: usize)
pub fn release(&self, size: usize)
Release size bytes back to the budget.
Saturates to zero if size exceeds the current allocation (which can
happen when data is replayed from WAL without a matching reservation).
Sourcepub fn utilization_percent(&self) -> u8
pub fn utilization_percent(&self) -> u8
Utilization as a percentage (0-100).
Sourcepub fn rejections(&self) -> usize
pub fn rejections(&self) -> usize
Number of rejected allocation attempts.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Budget
impl RefUnwindSafe for Budget
impl Send for Budget
impl Sync for Budget
impl Unpin for Budget
impl UnsafeUnpin for Budget
impl UnwindSafe for Budget
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