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,
}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.
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 holds_metadata(&self) -> bool
pub fn holds_metadata(&self) -> bool
Whether a live metadata node is in it.
Such an object cannot in general be freed by rewriting data blocks: a node
is relocated when the flush rewrites it, which happens because something
under it was dirtied, and which node covers which keys is not visible from
outside the map. Compaction skips these rather than rewriting their data
blocks for nothing — unless Self::meta_moves_with_data says the node
goes with the data.
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