pub struct WriteAmpTracker { /* private fields */ }Expand description
Tracks cumulative bytes rewritten per compaction cycle for write-amplification budgeting.
Thread-safe via atomics; designed to be shared across concurrent compaction tasks.
Implementations§
Source§impl WriteAmpTracker
impl WriteAmpTracker
Sourcepub fn record(&self, input_bytes: u64, output_bytes: u64)
pub fn record(&self, input_bytes: u64, output_bytes: u64)
Record bytes processed by a compaction task.
Sourcepub fn write_amplification(&self) -> f64
pub fn write_amplification(&self) -> f64
Current write amplification ratio (output / input).
Returns 0.0 if no input has been recorded.
Sourcepub fn budget_exhausted(&self, max_ratio: f64) -> bool
pub fn budget_exhausted(&self, max_ratio: f64) -> bool
Returns true if the budget is exhausted.
Sourcepub fn input_bytes(&self) -> u64
pub fn input_bytes(&self) -> u64
Total input bytes recorded.
Sourcepub fn output_bytes(&self) -> u64
pub fn output_bytes(&self) -> u64
Total output bytes recorded.
Trait Implementations§
Source§impl Debug for WriteAmpTracker
impl Debug for WriteAmpTracker
Auto Trait Implementations§
impl !Freeze for WriteAmpTracker
impl RefUnwindSafe for WriteAmpTracker
impl Send for WriteAmpTracker
impl Sync for WriteAmpTracker
impl Unpin for WriteAmpTracker
impl UnsafeUnpin for WriteAmpTracker
impl UnwindSafe for WriteAmpTracker
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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