pub struct StorageBlockManifest {
pub entries: HashMap<String, ManifestEntry>,
}Expand description
Catalogs all blocks in a storage partition.
Keyed by CID; supports fast lookup, consistency verification, filtering, pinning, statistics, merge, and sorted export.
Fields§
§entries: HashMap<String, ManifestEntry>Block entries indexed by CID.
Implementations§
Source§impl StorageBlockManifest
impl StorageBlockManifest
Sourcepub fn add_entry(&mut self, entry: ManifestEntry)
pub fn add_entry(&mut self, entry: ManifestEntry)
Add (or overwrite) an entry. The key used is entry.cid.
Sourcepub fn remove_entry(&mut self, cid: &str) -> bool
pub fn remove_entry(&mut self, cid: &str) -> bool
Remove an entry by CID.
Returns true if the entry existed and was removed, false otherwise.
Sourcepub fn get_entry(&self, cid: &str) -> Option<&ManifestEntry>
pub fn get_entry(&self, cid: &str) -> Option<&ManifestEntry>
Retrieve an entry by CID, or None if not present.
Sourcepub fn pin(&mut self, cid: &str) -> bool
pub fn pin(&mut self, cid: &str) -> bool
Mark the entry with the given CID as pinned.
Returns false if no such entry exists.
Sourcepub fn unpin(&mut self, cid: &str) -> bool
pub fn unpin(&mut self, cid: &str) -> bool
Mark the entry with the given CID as unpinned.
Returns false if no such entry exists.
Sourcepub fn filter(&self, filter: &ManifestFilter) -> Vec<&ManifestEntry>
pub fn filter(&self, filter: &ManifestFilter) -> Vec<&ManifestEntry>
Return all entries matching filter, sorted by added_at_secs ascending.
Sourcepub fn stats(&self) -> ManifestStats
pub fn stats(&self) -> ManifestStats
Compute aggregate statistics for the manifest.
Sourcepub fn merge(&mut self, other: &StorageBlockManifest)
pub fn merge(&mut self, other: &StorageBlockManifest)
Merge entries from other into self.
- If a CID in
otheris absent fromself, it is inserted. - If a CID is present in both and
other’s entry is pinned,self’s entry is also set to pinned (pin propagation).
Sourcepub fn export_cids(&self) -> Vec<String>
pub fn export_cids(&self) -> Vec<String>
Return all CIDs in the manifest, sorted alphabetically.
Sourcepub fn verify_checksums(&self) -> Vec<String>
pub fn verify_checksums(&self) -> Vec<String>
Return the CIDs of entries whose stored checksum does not match the FNV-1a hash recomputed from the CID bytes.
Trait Implementations§
Source§impl Clone for StorageBlockManifest
impl Clone for StorageBlockManifest
Source§fn clone(&self) -> StorageBlockManifest
fn clone(&self) -> StorageBlockManifest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StorageBlockManifest
impl Debug for StorageBlockManifest
Auto Trait Implementations§
impl Freeze for StorageBlockManifest
impl RefUnwindSafe for StorageBlockManifest
impl Send for StorageBlockManifest
impl Sync for StorageBlockManifest
impl Unpin for StorageBlockManifest
impl UnsafeUnpin for StorageBlockManifest
impl UnwindSafe for StorageBlockManifest
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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