pub struct ExtentMap {
pub len: u64,
pub extents: Vec<(u64, u64)>,
}Expand description
Allocation map of a file: logical length plus sorted, non-overlapping, byte-granular data extents.
Fields§
§len: u64Logical (apparent) file size in bytes.
extents: Vec<(u64, u64)>Sorted (offset, length) allocated ranges. Everything outside them reads as zeros.
Implementations§
Source§impl ExtentMap
impl ExtentMap
Sourcepub fn scan(path: &Path) -> Result<Option<ExtentMap>>
pub fn scan(path: &Path) -> Result<Option<ExtentMap>>
Scan path’s allocation map.
Returns Ok(None) when the filesystem cannot enumerate extents (no SEEK_DATA / allocated-ranges support); callers should then treat the file as fully dense. A dense file
on a capable filesystem scans as Some with a single (0, len) extent.
Blocking. Callers in async contexts should wrap in tokio::task::spawn_blocking.
Sourcepub fn scan_file(file: &File) -> Result<Option<ExtentMap>>
pub fn scan_file(file: &File) -> Result<Option<ExtentMap>>
ExtentMap::scan over an already-open file.
Sourcepub fn data_bytes(&self) -> u64
pub fn data_bytes(&self) -> u64
Sum of extent lengths — the bytes a sparse-aware reader must actually move.
Trait Implementations§
impl Eq for ExtentMap
impl StructuralPartialEq for ExtentMap
Auto Trait Implementations§
impl Freeze for ExtentMap
impl RefUnwindSafe for ExtentMap
impl Send for ExtentMap
impl Sync for ExtentMap
impl Unpin for ExtentMap
impl UnsafeUnpin for ExtentMap
impl UnwindSafe for ExtentMap
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
Mutably borrows from an owned value. Read more