pub struct StorageFragmentationAnalyzer {
pub extents: Vec<StorageExtent>,
}Expand description
Analyzes storage layout to detect fragmentation, recommend defragmentation targets, and estimate compaction savings.
Extents are maintained in ascending start_offset order at all times.
Fields§
§extents: Vec<StorageExtent>Storage extents, always sorted by start_offset.
Implementations§
Source§impl StorageFragmentationAnalyzer
impl StorageFragmentationAnalyzer
Sourcepub fn add_extent(&mut self, extent: StorageExtent)
pub fn add_extent(&mut self, extent: StorageExtent)
Add an extent, maintaining sorted order by start_offset.
Sourcepub fn free_extent(&mut self, cid: &str)
pub fn free_extent(&mut self, cid: &str)
Mark the extent whose CID matches cid as free space.
If no extent matches, this is a no-op.
Sourcepub fn analyze(&self) -> FragmentationReport
pub fn analyze(&self) -> FragmentationReport
Walk all extents and compute fragmentation statistics.
Sourcepub fn compaction_plan(&self) -> Vec<CompactionCandidate>
pub fn compaction_plan(&self) -> Vec<CompactionCandidate>
Compute which live blocks would need to move to achieve a fully
left-packed layout, ordered by descending bytes_saved.
Only blocks whose target_offset is strictly less than
current_offset are included.
Sourcepub fn merge_free_extents(&mut self)
pub fn merge_free_extents(&mut self)
Merge adjacent free extents into a single larger free extent.
After this call the extent list is still sorted by start_offset.
Sourcepub fn total_extents(&self) -> usize
pub fn total_extents(&self) -> usize
Return the total number of extents (used and free).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StorageFragmentationAnalyzer
impl RefUnwindSafe for StorageFragmentationAnalyzer
impl Send for StorageFragmentationAnalyzer
impl Sync for StorageFragmentationAnalyzer
impl Unpin for StorageFragmentationAnalyzer
impl UnsafeUnpin for StorageFragmentationAnalyzer
impl UnwindSafe for StorageFragmentationAnalyzer
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
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>
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