pub struct TreeManifest { /* private fields */ }Expand description
Indexed tree manifest.
Holds file entries as raw CBOR bytes with a sorted offset table for O(log N) single-file lookup. Metadata (shards, totals) is parsed eagerly.
Constructed via TreeManifestBuilder or TreeManifest::open.
Implementations§
Source§impl TreeManifest
impl TreeManifest
Sourcepub fn builder() -> TreeManifestBuilder
pub fn builder() -> TreeManifestBuilder
Create a builder for constructing a new manifest.
Sourcepub fn from_commit(
store: &impl ObjectStoreExt,
commit: &Commit,
reader: &CommitReader,
) -> Result<Option<Self>>
pub fn from_commit( store: &impl ObjectStoreExt, commit: &Commit, reader: &CommitReader, ) -> Result<Option<Self>>
Load and decrypt the TreeManifest from a commit.
Extracts the manifest CID from the commit, fetches the encrypted blob from the store, decrypts it with the reader’s content key, and parses it.
Returns None if the commit has no manifest_cid.
Sourcepub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes(&self) -> &[u8] ⓘ
Returns the serialized CBOR bytes for encryption and storage.
Sourcepub fn lookup(&self, path: &str) -> Result<ManifestEntry>
pub fn lookup(&self, path: &str) -> Result<ManifestEntry>
Look up a single file by path. O(log N).
Binary searches the offset table, parsing one entry per probe to compare paths.
Sourcepub fn iter(&self) -> ManifestIter<'_> ⓘ
pub fn iter(&self) -> ManifestIter<'_> ⓘ
Iterate all file entries in path-sorted order. O(N).
Sourcepub fn shards(&self) -> &[ShardReference]
pub fn shards(&self) -> &[ShardReference]
Returns the shard references.
Sourcepub fn total_files(&self) -> u64
pub fn total_files(&self) -> u64
Total number of files.
Sourcepub fn total_bytes(&self) -> u64
pub fn total_bytes(&self) -> u64
Total bytes across all files.
Sourcepub fn paths_hash(&self) -> &[u8; 32]
pub fn paths_hash(&self) -> &[u8; 32]
SHA256 hash of sorted paths.
Sourcepub fn entry_count(&self) -> usize
pub fn entry_count(&self) -> usize
Number of file entries.
Sourcepub fn list_dir(&self, path: &str) -> Result<Vec<DirChild>>
pub fn list_dir(&self, path: &str) -> Result<Vec<DirChild>>
List the immediate children of a directory.
Returns files and subdirectories directly under path.
Use "" for the root directory.
Entries are sorted by path, so we can efficiently find the range of entries under a prefix and derive the directory listing.
Sourcepub fn entries_by_shard(&self) -> Result<Vec<Vec<ManifestEntry>>>
pub fn entries_by_shard(&self) -> Result<Vec<Vec<ManifestEntry>>>
Group file entries by shard index.
Returns a vec indexed by shard position, where each element contains the
ManifestEntry items stored in that shard. Callers can iterate shard-by-shard
to decrypt each shard once and extract all files from it.
Auto Trait Implementations§
impl Freeze for TreeManifest
impl RefUnwindSafe for TreeManifest
impl Send for TreeManifest
impl Sync for TreeManifest
impl Unpin for TreeManifest
impl UnsafeUnpin for TreeManifest
impl UnwindSafe for TreeManifest
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
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