Skip to main content

MmapIndex

Struct MmapIndex 

Source
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

Source

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).

Source

pub fn dir_records(&self) -> &[DirRecord]

Get the directory records table (sorted by path).

Source

pub fn get_str(&self, off: u32, len: u16) -> &[u8]

Get a string from the string pool by offset and length.

Source

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.

Source

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.

Source

pub fn dir_entries(&self, dir: &DirRecord) -> &[EntryRecord]

Get the contiguous entry slice for a directory.

Source

pub fn is_opaque(&self, dir: &DirRecord) -> bool

Check if a directory is opaque.

Source

pub fn has_whiteout(&self, dir: &DirRecord, name: &[u8]) -> bool

Check if a name is whited out in a directory.

Source

pub fn tombstone_names<'a>(&'a self, dir: &DirRecord) -> TombstoneIter<'a>

Iterate overflow tombstone names for a directory.

Get the hardlink reference table.

Source

pub fn find_aliases(&self, ino: u64) -> &[HardlinkRef]

Find all aliases of a hardlinked file by host inode number.

Get a hardlink ref’s path string.

Trait Implementations§

Source§

impl Drop for MmapIndex

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for MmapIndex

Source§

impl Sync for MmapIndex

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.