pub trait FileSystem: Send + Sync {
Show 17 methods
// Required methods
fn kind(&self) -> FsKind;
fn root(&self) -> FileId;
fn sector_sizes(&self) -> SectorSizes;
fn timestamp_zone(&self) -> TimeZonePolicy;
fn read_dir(&self, ino: FileId) -> VfsResult<DirStream>;
fn extents(&self, ino: FileId, stream: StreamId) -> VfsResult<ExtentStream>;
fn lookup(&self, parent: FileId, name: &[u8]) -> VfsResult<Option<FileId>>;
fn meta(&self, ino: FileId) -> VfsResult<FsMeta>;
fn read_at(
&self,
ino: FileId,
stream: StreamId,
off: u64,
buf: &mut [u8],
) -> VfsResult<usize>;
fn read_link(&self, ino: FileId, cap: usize) -> VfsResult<Vec<u8>>;
fn deleted(&self) -> VfsResult<NodeStream>;
fn unallocated(&self) -> VfsResult<ExtentStream>;
// Provided methods
fn volume_label(&self) -> Option<String> { ... }
fn data_streams(&self, ino: FileId) -> VfsResult<Vec<StreamInfo>> { ... }
fn hardlinks(&self, ino: FileId) -> VfsResult<Vec<HardLink>> { ... }
fn deleted_nodes(&self) -> VfsResult<DeletedStream> { ... }
fn slack(&self, ino: FileId, stream: StreamId) -> VfsResult<Option<ByteRun>> { ... }
}Expand description
One mounted, read-only filesystem. Inode-addressed; &self reads share one
handle across workers; internal caches use interior mutability, never
&mut self.
Required Methods§
fn kind(&self) -> FsKind
fn root(&self) -> FileId
fn sector_sizes(&self) -> SectorSizes
fn timestamp_zone(&self) -> TimeZonePolicy
Sourcefn read_dir(&self, ino: FileId) -> VfsResult<DirStream>
fn read_dir(&self, ino: FileId) -> VfsResult<DirStream>
Stream the children of a directory (owned, Send).
Sourcefn extents(&self, ino: FileId, stream: StreamId) -> VfsResult<ExtentStream>
fn extents(&self, ino: FileId, stream: StreamId) -> VfsResult<ExtentStream>
Stream the runs of one data stream of a node (owned, Send).
fn lookup(&self, parent: FileId, name: &[u8]) -> VfsResult<Option<FileId>>
fn meta(&self, ino: FileId) -> VfsResult<FsMeta>
fn read_at( &self, ino: FileId, stream: StreamId, off: u64, buf: &mut [u8], ) -> VfsResult<usize>
Sourcefn read_link(&self, ino: FileId, cap: usize) -> VfsResult<Vec<u8>>
fn read_link(&self, ino: FileId, cap: usize) -> VfsResult<Vec<u8>>
Read a symlink target, capped so a hostile symlink cannot allocate without bound.
Sourcefn deleted(&self) -> VfsResult<NodeStream>
fn deleted(&self) -> VfsResult<NodeStream>
Deleted/orphan nodes, streamed (never an eager Vec).
Sourcefn unallocated(&self) -> VfsResult<ExtentStream>
fn unallocated(&self) -> VfsResult<ExtentStream>
Unallocated runs, streamed.
Provided Methods§
Sourcefn volume_label(&self) -> Option<String>
fn volume_label(&self) -> Option<String>
The filesystem’s own volume label / name, decoded per the filesystem’s defined
encoding (NTFS $VOLUME_NAME UTF-16LE, FAT/exFAT label, ext4 s_volume_name,
APFS volume name), or None when the volume is unlabeled or the reader does not
extract it. This is the filesystem label (e.g. “System Reserved”), distinct
from a partition-table name (VolumeDesc.label).
fn data_streams(&self, ino: FileId) -> VfsResult<Vec<StreamInfo>>
Sourcefn hardlinks(&self, ino: FileId) -> VfsResult<Vec<HardLink>>
fn hardlinks(&self, ino: FileId) -> VfsResult<Vec<HardLink>>
Hardlink back-references (capped by the implementation).
Sourcefn deleted_nodes(&self) -> VfsResult<DeletedStream>
fn deleted_nodes(&self) -> VfsResult<DeletedStream>
Deleted/orphan nodes with recovered identity — a readable FileId,
name, and parent — so a consumer can render a deleted file in place (or
route an orphan to a bucket) and read its bytes. The default is an
empty stream: a reader opts in by overriding this once it can
recover the name + parent + id from its on-disk structures (e.g. NTFS
$FILE_NAME + the MFT reference). It never fabricates an entry. This is
the surface deleted cannot provide — that one yields
bare FsMeta with no id to read the node.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".