pub struct StorageStats {Show 13 fields
pub used_bytes: u64,
pub capacity_bytes: Option<u64>,
pub available_bytes: Option<u64>,
pub compaction_possible: bool,
pub full_compaction_bytes: u64,
pub tight_compaction_bytes: u64,
pub item_count: u64,
pub table_count: u64,
pub avg_entry_on_disk_bytes: u64,
pub avg_key_bytes: Option<u64>,
pub avg_value_bytes: Option<u64>,
pub reclaimable_bytes_estimate: u64,
pub status: StorageStatus,
}Expand description
A point-in-time snapshot of a tree’s on-disk storage footprint and the average shape of a stored entry.
All byte figures are on-disk (post-compression, including any per-block
overhead and blob files). Averages are over every stored entry version, so
they pair with Self::item_count.
Fields§
§used_bytes: u64Total on-disk bytes of all live SSTs plus blob files: how much is
occupied. Pairs with Self::capacity_bytes / Self::available_bytes
for an “X of Y used” view in a single call.
capacity_bytes: Option<u64>Total bytes the tree may occupy: the tighter of a configured byte quota
(storage_limit_bytes) and the physical disk headroom (free space plus
what is already used), across every volume the tree writes to. None
when unbounded: no quota set AND the backend cannot report free space.
available_bytes: Option<u64>Free room left before the tree turns read-only: capacity_bytes - used_bytes
(saturating). None exactly when Self::capacity_bytes is None
(unbounded).
compaction_possible: boolWhether a compaction can still run given the remaining free space (it
needs working room to write merged output). true when unbounded or
when at least Self::tight_compaction_bytes of free space remains;
false when the disk is too full for a compaction to make progress. The
finer full-vs-tight distinction is carried by Self::status.
full_compaction_bytes: u64Estimated free space (bytes) a FULL compaction needs for its transient
output while the inputs still exist: the largest level’s on-disk size
(an upper bound on a single merge’s input set). A full compaction has
room when Self::available_bytes >= this. Pair with used_bytes /
capacity_bytes to draw a capacity gauge: used → used + tight_compaction_bytes
→ used + full_compaction_bytes → capacity.
tight_compaction_bytes: u64Estimated free space (bytes) a minimal (tight) space-reclaiming
compaction needs to make forward progress: the reserved working floor.
Tight compaction has room when Self::available_bytes >= this.
item_count: u64Number of live entries (all versions) across all live SSTs.
table_count: u64Number of live SSTs.
avg_entry_on_disk_bytes: u64Average on-disk bytes per entry (used_bytes / item_count), or 0 when
the tree is empty. This is the figure
Self::estimated_remaining_entries divides a budget by.
avg_key_bytes: Option<u64>Average user-key byte length per entry, or None if any live table was
written before per-table key/value byte sums were recorded (the average
key/value split is only exact when every table carries the figures).
avg_value_bytes: Option<u64>Average value byte length per entry, or None under the same condition
as Self::avg_key_bytes.
reclaimable_bytes_estimate: u64Estimated bytes a full compaction could reclaim, from the weak-tombstone-reclaimable entry count times the average on-disk entry size. An estimate, not an exact figure.
status: StorageStatusCoarse storage state.
Implementations§
Source§impl StorageStats
impl StorageStats
Sourcepub fn estimated_remaining_entries(&self, budget_bytes: u64) -> u64
pub fn estimated_remaining_entries(&self, budget_bytes: u64) -> u64
Approximately how many more average-shaped entries fit in budget_bytes,
using Self::avg_entry_on_disk_bytes.
Returns 0 when the average entry size is unknown (an empty tree), since
there is no basis for the estimate.
Trait Implementations§
Source§impl Clone for StorageStats
impl Clone for StorageStats
Source§fn clone(&self) -> StorageStats
fn clone(&self) -> StorageStats
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for StorageStats
Source§impl Debug for StorageStats
impl Debug for StorageStats
impl Eq for StorageStats
Source§impl PartialEq for StorageStats
impl PartialEq for StorageStats
Source§fn eq(&self, other: &StorageStats) -> bool
fn eq(&self, other: &StorageStats) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for StorageStats
Auto Trait Implementations§
impl Freeze for StorageStats
impl RefUnwindSafe for StorageStats
impl Send for StorageStats
impl Sync for StorageStats
impl Unpin for StorageStats
impl UnsafeUnpin for StorageStats
impl UnwindSafe for StorageStats
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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>
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>
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