pub struct MmapIndex { /* private fields */ }Expand description
Zero-copy reader for a mmap’d layer sidecar index.
Immutable after construction. The mmap region is PROT_READ | MAP_PRIVATE,
so this is Send + Sync.
Implementations§
Source§impl MmapIndex
impl MmapIndex
Sourcepub fn open(path: &Path) -> Option<Self>
pub fn open(path: &Path) -> Option<Self>
Open and validate a sidecar index file.
Returns None if the file doesn’t exist, is too small, or fails any
validation check (magic, version, checksum, size consistency).
Sourcepub fn dir_records(&self) -> &[DirRecord]
pub fn dir_records(&self) -> &[DirRecord]
Get the directory records table (sorted by path).
Sourcepub fn get_str(&self, off: u32, len: u16) -> &[u8] ⓘ
pub fn get_str(&self, off: u32, len: u16) -> &[u8] ⓘ
Get a string from the string pool by offset and length.
Sourcepub fn find_dir(&self, path: &[u8]) -> Option<(usize, &DirRecord)>
pub fn find_dir(&self, path: &[u8]) -> Option<(usize, &DirRecord)>
Find a directory by path. Returns (index, &DirRecord).
Binary search on the sorted directory table.
Sourcepub fn find_entry<'a>(
&'a self,
dir: &DirRecord,
name: &[u8],
) -> Option<&'a EntryRecord>
pub fn find_entry<'a>( &'a self, dir: &DirRecord, name: &[u8], ) -> Option<&'a EntryRecord>
Find an entry within a directory by name.
Binary search on the entry slice for this directory.
Sourcepub fn dir_entries(&self, dir: &DirRecord) -> &[EntryRecord]
pub fn dir_entries(&self, dir: &DirRecord) -> &[EntryRecord]
Get the contiguous entry slice for a directory.
Sourcepub fn has_whiteout(&self, dir: &DirRecord, name: &[u8]) -> bool
pub fn has_whiteout(&self, dir: &DirRecord, name: &[u8]) -> bool
Check if a name is whited out in a directory.
Sourcepub fn tombstone_names<'a>(&'a self, dir: &DirRecord) -> TombstoneIter<'a> ⓘ
pub fn tombstone_names<'a>(&'a self, dir: &DirRecord) -> TombstoneIter<'a> ⓘ
Iterate overflow tombstone names for a directory.
Sourcepub fn hardlink_refs(&self) -> &[HardlinkRef]
pub fn hardlink_refs(&self) -> &[HardlinkRef]
Get the hardlink reference table.
Sourcepub fn find_aliases(&self, ino: u64) -> &[HardlinkRef]
pub fn find_aliases(&self, ino: u64) -> &[HardlinkRef]
Find all aliases of a hardlinked file by host inode number.
Sourcepub fn hardlink_path(&self, href: &HardlinkRef) -> &[u8] ⓘ
pub fn hardlink_path(&self, href: &HardlinkRef) -> &[u8] ⓘ
Get a hardlink ref’s path string.