Skip to main content

StorageStats

Struct StorageStats 

Source
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: u64

Total 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: bool

Whether 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: u64

Estimated 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: usedused + tight_compaction_bytesused + full_compaction_bytescapacity.

§tight_compaction_bytes: u64

Estimated 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: u64

Number of live entries (all versions) across all live SSTs.

§table_count: u64

Number of live SSTs.

§avg_entry_on_disk_bytes: u64

Average 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: u64

Estimated 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: StorageStatus

Coarse storage state.

Implementations§

Source§

impl StorageStats

Source

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

Source§

fn clone(&self) -> StorageStats

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for StorageStats

Source§

impl Debug for StorageStats

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for StorageStats

Source§

impl PartialEq for StorageStats

Source§

fn eq(&self, other: &StorageStats) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for StorageStats

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V