pub struct ObjectUsage {
pub segid: SegmentId,
pub bytes: u64,
pub live_data_blocks: usize,
pub live_meta_blocks: usize,
pub live_bytes: u64,
pub meta_moves_with_data: bool,
pub extra_blocks: usize,
pub unfreeable_nodes: usize,
pub rewrite_bytes: u64,
}Expand description
How much of one stored object is still pointed into.
Fields§
§segid: SegmentIdThe object, <cno> or <cno>.<part>.
bytes: u64Its size on storage.
live_data_blocks: usizeLive data blocks in it.
live_meta_blocks: usizeLive metadata nodes in it.
live_bytes: u64What those occupy, by the container’s own block sizes.
meta_moves_with_data: boolWhether the live metadata in it is rewritten by rewriting its live data.
True for a data part — any part above 0 — of a StreamSegment container.
That layout puts every leaf of the block map in the object holding the data
under it, and the nodes above the leaves in part 0 only. A leaf in a data
part is therefore live only while none of the blocks it was written with
has changed, so those blocks are live and in the same object; relocating
them dirties the leaf, and the flush writes it elsewhere with them.
Under every other format the nodes sit in part 0 or the one object, apart
from the data they describe, and this is false.
extra_blocks: usizeLive index nodes in it with no block under them in this object, each rewritten by relocating one block under it from wherever that is: a block’s new place dirties every node above it. What freeing the object costs beyond its own live data.
unfreeable_nodes: usizeLive index nodes in it with no block on storage found under them (holes, zero blocks): nothing a compaction marks rewrites them, and the object is not a candidate.
rewrite_bytes: u64What freeing it rewrites: its live data blocks and the extra ones, and the nodes the flush writes anew.
Implementations§
Source§impl ObjectUsage
impl ObjectUsage
Sourcepub fn is_dead(&self) -> bool
pub fn is_dead(&self) -> bool
Nothing points into it: prune can take it, compaction has no work here.
Sourcepub fn live_ratio(&self) -> f64
pub fn live_ratio(&self) -> f64
Live bytes over stored bytes. Zero for a dead object, and the cost side
of the trade: rewriting this much frees Self::bytes.
Sourcepub fn cost_ratio(&self) -> f64
pub fn cost_ratio(&self) -> f64
What freeing it rewrites over what it stores: Self::rewrite_bytes
over Self::bytes. The cost side of the trade, as the policy’s
max_live_ratio measures it.
Sourcepub fn holds_metadata(&self) -> bool
pub fn holds_metadata(&self) -> bool
Whether a live metadata node is in it. A node is rewritten when the
flush writes something under it anew, so compaction frees such an object
by relocating its own live data and, for a node with nothing under it
here, one block under it from elsewhere (Self::extra_blocks).
Trait Implementations§
Source§impl Clone for ObjectUsage
impl Clone for ObjectUsage
Source§impl Debug for ObjectUsage
impl Debug for ObjectUsage
impl Eq for ObjectUsage
Source§impl PartialEq for ObjectUsage
impl PartialEq for ObjectUsage
impl StructuralPartialEq for ObjectUsage
Auto Trait Implementations§
impl Freeze for ObjectUsage
impl RefUnwindSafe for ObjectUsage
impl Send for ObjectUsage
impl Sync for ObjectUsage
impl Unpin for ObjectUsage
impl UnsafeUnpin for ObjectUsage
impl UnwindSafe for ObjectUsage
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> ⓘ
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