pub trait HandleBackend {
Show 28 methods
// Required methods
fn sync_data(&mut self, tcf: &FileOperand) -> VfResult<()>;
fn open_impl(&mut self, request: &OpenOp<'_>) -> VfResult<FileOperand>;
fn close_impl(&mut self, file: &FileOperand) -> VfResult<()>;
fn read_impl(&mut self, request: &ReadOp) -> VfResult<ReadResult>;
fn write_impl(
&mut self,
request: WriteOp<&FileOperand, &[u8]>,
) -> VfResult<WriteResult>;
fn seek_impl(
&mut self,
file: &FileOperand,
position: SeekFrom,
) -> VfResult<u64>;
fn metadata_impl(
&mut self,
target: Target<'_, FileOperand>,
options: AttrsOptions,
) -> VfResult<VfAttrs>;
fn set_attributes_impl(
&mut self,
update: &SetAttrsOp<Target<'_, FileOperand>>,
) -> VfResult<()>;
// Provided methods
fn prepare_object_refs(&mut self, _files: &[&FileOperand]) -> VfResult<()> { ... }
fn open_object_ref(
&self,
_file: &FileOperand,
) -> VfResult<Option<OpenObjectRef<'_>>> { ... }
fn vstatfs_impl(
&mut self,
files: &[FileOperand],
) -> VfResult<Vec<FilesystemStats>> { ... }
fn close_deferred(&mut self, file: &FileOperand) -> VfResult<()> { ... }
fn take_notifications(&mut self) -> Vec<Box<dyn FnOnce() + Send>> { ... }
fn capabilities(&self) -> Capabilities { ... }
fn abs_path(&self, path: &Path) -> PathBuf { ... }
fn open_path_impl(
&mut self,
_base: VfPathBase,
_pathname: &Path,
_flags: i32,
_mode: u32,
) -> VfResult<FileOperand> { ... }
fn vfsync_impl(&mut self, files: &[FileOperand], mode: SyncMode) -> VfRes { ... }
fn sync_all(&mut self, tcf: &FileOperand) -> VfResult<()> { ... }
fn chdir(&mut self, _path: &Path) -> VfResult<()> { ... }
fn getcwd(&self) -> PathBuf { ... }
fn seek_raw_impl(
&mut self,
_tcf: &FileOperand,
_offset: i64,
_whence: SeekFrom,
) -> VfResult<i64> { ... }
fn vf_path(&self, file: &FileOperand) -> VfResult<PathBuf> { ... }
fn open_raw_impl(
&mut self,
pathname: &Path,
flags: i32,
mode: u32,
) -> VfResult<FileOperand> { ... }
fn read_raw_impl(
&mut self,
file: &FileOperand,
offset: u64,
length: usize,
) -> VfResult<Vec<u8>> { ... }
fn write_raw_impl(
&mut self,
file: &FileOperand,
offset: u64,
data: &[u8],
) -> VfResult<usize> { ... }
fn read_file_impl(
&mut self,
file: &FileOperand,
max_bytes: usize,
) -> VfResult<Vec<u8>> { ... }
fn read_into_impl(
&mut self,
request: &ReadOp,
buffer: &mut [u8],
) -> VfResult<ReadIntoResult> { ... }
fn vsetattrs_impl(
&mut self,
updates: &[SetAttrsOp<Target<'_, FileOperand>>],
) -> VfResult<()> { ... }
}Expand description
Minimum contract for owned handles and descriptor lifecycle. This includes handle-level metadata/statistics hooks, but does not require namespace operations, directory enumeration, or native vector I/O.
Required Methods§
fn sync_data(&mut self, tcf: &FileOperand) -> VfResult<()>
fn open_impl(&mut self, request: &OpenOp<'_>) -> VfResult<FileOperand>
fn close_impl(&mut self, file: &FileOperand) -> VfResult<()>
fn read_impl(&mut self, request: &ReadOp) -> VfResult<ReadResult>
fn write_impl( &mut self, request: WriteOp<&FileOperand, &[u8]>, ) -> VfResult<WriteResult>
fn seek_impl(&mut self, file: &FileOperand, position: SeekFrom) -> VfResult<u64>
Sourcefn metadata_impl(
&mut self,
target: Target<'_, FileOperand>,
options: AttrsOptions,
) -> VfResult<VfAttrs>
fn metadata_impl( &mut self, target: Target<'_, FileOperand>, options: AttrsOptions, ) -> VfResult<VfAttrs>
Query a raw backend target with the same field/symlink options used by the application interface. Returned attributes retain target identity.
Sourcefn set_attributes_impl(
&mut self,
update: &SetAttrsOp<Target<'_, FileOperand>>,
) -> VfResult<()>
fn set_attributes_impl( &mut self, update: &SetAttrsOp<Target<'_, FileOperand>>, ) -> VfResult<()>
Apply one shared attribute operation. Raw timestamps and masks are converted by the backend, not exposed through a second mutation type.
Provided Methods§
Sourcefn prepare_object_refs(&mut self, _files: &[&FileOperand]) -> VfResult<()>
fn prepare_object_refs(&mut self, _files: &[&FileOperand]) -> VfResult<()>
Prepare object references in one backend batch when metadata is needed.
Inputs retain request order so failure indices remain attributable.
References returned for the batch must use a consistent, canonical
representation. Return None when potentially aliased objects cannot
be compared safely; unequal noncanonical filehandles are insufficient.
Sourcefn open_object_ref(
&self,
_file: &FileOperand,
) -> VfResult<Option<OpenObjectRef<'_>>>
fn open_object_ref( &self, _file: &FileOperand, ) -> VfResult<Option<OpenObjectRef<'_>>>
Reference to the object pinned by a live File Descriptor, if available. Completion scheduling conservatively assumes aliasing when unknown. Saved paths and OPEN stateids must never be used as object references.
fn vstatfs_impl( &mut self, files: &[FileOperand], ) -> VfResult<Vec<FilesystemStats>>
fn close_deferred(&mut self, file: &FileOperand) -> VfResult<()>
fn take_notifications(&mut self) -> Vec<Box<dyn FnOnce() + Send>>
fn capabilities(&self) -> Capabilities
fn abs_path(&self, path: &Path) -> PathBuf
fn open_path_impl( &mut self, _base: VfPathBase, _pathname: &Path, _flags: i32, _mode: u32, ) -> VfResult<FileOperand>
Sourcefn vfsync_impl(&mut self, files: &[FileOperand], mode: SyncMode) -> VfRes
fn vfsync_impl(&mut self, files: &[FileOperand], mode: SyncMode) -> VfRes
One backend synchronization vector. POSIX backends may loop under one lock because fsync has no vector syscall; protocol backends may batch.
fn sync_all(&mut self, tcf: &FileOperand) -> VfResult<()>
fn chdir(&mut self, _path: &Path) -> VfResult<()>
fn getcwd(&self) -> PathBuf
fn seek_raw_impl( &mut self, _tcf: &FileOperand, _offset: i64, _whence: SeekFrom, ) -> VfResult<i64>
fn vf_path(&self, file: &FileOperand) -> VfResult<PathBuf>
fn open_raw_impl( &mut self, pathname: &Path, flags: i32, mode: u32, ) -> VfResult<FileOperand>
fn read_raw_impl( &mut self, file: &FileOperand, offset: u64, length: usize, ) -> VfResult<Vec<u8>>
fn write_raw_impl( &mut self, file: &FileOperand, offset: u64, data: &[u8], ) -> VfResult<usize>
fn read_file_impl( &mut self, file: &FileOperand, max_bytes: usize, ) -> VfResult<Vec<u8>>
fn read_into_impl( &mut self, request: &ReadOp, buffer: &mut [u8], ) -> VfResult<ReadIntoResult>
Sourcefn vsetattrs_impl(
&mut self,
updates: &[SetAttrsOp<Target<'_, FileOperand>>],
) -> VfResult<()>
fn vsetattrs_impl( &mut self, updates: &[SetAttrsOp<Target<'_, FileOperand>>], ) -> VfResult<()>
Borrow an ordered batch without transferring request ownership. Each operation carries its own final-symlink policy; native backends batch contiguous equal-policy runs and validate all inputs before I/O.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".