pub trait Vfs: Send + Sync {
Show 22 methods
// Required methods
fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
is_dir: bool,
access: u32,
disposition: u32,
options: u32,
attrs: u32,
) -> Pin<Box<dyn Future<Output = VfsResult<(Box<OpenFile>, FileMeta, u32)>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
open: &'life1 mut OpenFile,
offset: u64,
len: usize,
) -> Pin<Box<dyn Future<Output = VfsResult<Vec<u8>>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn write<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
open: &'life1 mut OpenFile,
offset: u64,
data: &'life2 [u8],
write_through: bool,
) -> Pin<Box<dyn Future<Output = VfsResult<u64>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn seek<'life0, 'life1, 'async_trait>(
&'life0 self,
open: &'life1 mut OpenFile,
mode: u16,
offset: i64,
) -> Pin<Box<dyn Future<Output = VfsResult<u64>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn flush<'life0, 'life1, 'async_trait>(
&'life0 self,
open: &'life1 mut OpenFile,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn flush_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn close<'life0, 'async_trait>(
&'life0 self,
open: Box<OpenFile>,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn mkdir<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn rmdir<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn check_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn unlink<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete_pattern<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
dir_rel: &'life1 str,
pattern: &'life2 str,
) -> Pin<Box<dyn Future<Output = VfsResult<bool>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn rename<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
old_rel: &'life1 str,
new_rel: &'life2 str,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
dir_rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<Vec<Entry>>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn stat<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<FileMeta>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn set_info_open<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
open: &'life1 mut OpenFile,
op: &'life2 SetOp,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn set_info_path<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
rel: &'life1 str,
op: &'life2 SetOp,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn query_disk<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = VfsResult<(u32, u32, u16, u16)>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn zero_range<'life0, 'life1, 'async_trait>(
&'life0 self,
open: &'life1 mut OpenFile,
offset: u64,
len: u64,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn get_security<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<Option<Vec<u8>>>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn set_security<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
rel: &'life1 str,
descriptor: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn list_streams<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<Vec<(String, u64)>>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Storage abstraction used by the protocol dispatchers.
Implementations own their handle state (inside
OpenFile::inner) and are responsible for
mapping relative share paths onto physical storage, including refusing
path traversal.
The trait uses ?Send futures so backends can hold thread-local io_uring
resources (which are !Send); the implementor object is still
Send + Sync so a single backend can be shared across per-core runtimes.
All I/O must be non-blocking (io_uring / async), never blocking the runtime.
Required Methods§
Sourcefn create<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
is_dir: bool,
access: u32,
disposition: u32,
options: u32,
attrs: u32,
) -> Pin<Box<dyn Future<Output = VfsResult<(Box<OpenFile>, FileMeta, u32)>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
is_dir: bool,
access: u32,
disposition: u32,
options: u32,
attrs: u32,
) -> Pin<Box<dyn Future<Output = VfsResult<(Box<OpenFile>, FileMeta, u32)>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create or open rel according to the NT-style parameters.
Returns the populated OpenFile, a metadata snapshot and the create
action taken (superseded / opened / created / overwritten).
Sourcefn read<'life0, 'life1, 'async_trait>(
&'life0 self,
open: &'life1 mut OpenFile,
offset: u64,
len: usize,
) -> Pin<Box<dyn Future<Output = VfsResult<Vec<u8>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
open: &'life1 mut OpenFile,
offset: u64,
len: usize,
) -> Pin<Box<dyn Future<Output = VfsResult<Vec<u8>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Read up to len bytes at offset.
Sourcefn write<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
open: &'life1 mut OpenFile,
offset: u64,
data: &'life2 [u8],
write_through: bool,
) -> Pin<Box<dyn Future<Output = VfsResult<u64>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn write<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
open: &'life1 mut OpenFile,
offset: u64,
data: &'life2 [u8],
write_through: bool,
) -> Pin<Box<dyn Future<Output = VfsResult<u64>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Write data at offset, returning bytes written. When write_through
is set the data must reach stable storage before returning.
Sourcefn seek<'life0, 'life1, 'async_trait>(
&'life0 self,
open: &'life1 mut OpenFile,
mode: u16,
offset: i64,
) -> Pin<Box<dyn Future<Output = VfsResult<u64>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn seek<'life0, 'life1, 'async_trait>(
&'life0 self,
open: &'life1 mut OpenFile,
mode: u16,
offset: i64,
) -> Pin<Box<dyn Future<Output = VfsResult<u64>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reposition the file pointer; mode follows the SMB1 SEEK semantics
(0 = from start, 1 = current, 2 = from end) and returns the new offset.
Sourcefn flush<'life0, 'life1, 'async_trait>(
&'life0 self,
open: &'life1 mut OpenFile,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn flush<'life0, 'life1, 'async_trait>(
&'life0 self,
open: &'life1 mut OpenFile,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Flush one handle.
Sourcefn flush_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn flush_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Flush every handle the backend currently keeps.
Sourcefn close<'life0, 'async_trait>(
&'life0 self,
open: Box<OpenFile>,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 self,
open: Box<OpenFile>,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Close a handle, applying pending deletion when requested.
Sourcefn mkdir<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mkdir<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a directory.
Sourcefn rmdir<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn rmdir<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove an (empty) directory.
Sourcefn check_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn check_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Verify a directory exists.
Sourcefn unlink<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn unlink<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete exactly one file (never directories).
Sourcefn delete_pattern<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
dir_rel: &'life1 str,
pattern: &'life2 str,
) -> Pin<Box<dyn Future<Output = VfsResult<bool>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete_pattern<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
dir_rel: &'life1 str,
pattern: &'life2 str,
) -> Pin<Box<dyn Future<Output = VfsResult<bool>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Delete all files matching pattern inside directory dir_rel;
returns whether anything was removed. Wildcards */? honoured.
Sourcefn rename<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
old_rel: &'life1 str,
new_rel: &'life2 str,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn rename<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
old_rel: &'life1 str,
new_rel: &'life2 str,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Rename old_rel to new_rel.
Sourcefn list<'life0, 'life1, 'async_trait>(
&'life0 self,
dir_rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<Vec<Entry>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
dir_rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<Vec<Entry>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List entries of dir_rel with metadata snapshots.
Sourcefn stat<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<FileMeta>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stat<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<FileMeta>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stat a path without opening it.
Sourcefn set_info_open<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
open: &'life1 mut OpenFile,
op: &'life2 SetOp,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn set_info_open<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
open: &'life1 mut OpenFile,
op: &'life2 SetOp,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Apply one neutral set-information operation to an open handle.
Sourcefn set_info_path<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
rel: &'life1 str,
op: &'life2 SetOp,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn set_info_path<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
rel: &'life1 str,
op: &'life2 SetOp,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Apply one neutral set-information operation to a path.
Provided Methods§
Sourcefn zero_range<'life0, 'life1, 'async_trait>(
&'life0 self,
open: &'life1 mut OpenFile,
offset: u64,
len: u64,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn zero_range<'life0, 'life1, 'async_trait>(
&'life0 self,
open: &'life1 mut OpenFile,
offset: u64,
len: u64,
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Zero the byte range [offset, offset + len) of an open handle
(FSCTL_SET_ZERO_DATA). The default writes zeros through Vfs::write;
backends may override to punch a sparse hole.
Sourcefn get_security<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<Option<Vec<u8>>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_security<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<Option<Vec<u8>>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch the raw self-relative NT security descriptor stored for rel
([MS-DTYP] §2.4.6), or None when the backend has none (the caller then
synthesises a default). Default backends store nothing.
Sourcefn set_security<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
rel: &'life1 str,
descriptor: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn set_security<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
rel: &'life1 str,
descriptor: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = VfsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Persist a raw self-relative NT security descriptor for rel. Default
backends accept and discard it (no ACL storage).
Sourcefn list_streams<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<Vec<(String, u64)>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_streams<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 str,
) -> Pin<Box<dyn Future<Output = VfsResult<Vec<(String, u64)>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List the alternate data streams of rel as (smb_stream_name, size)
pairs (e.g. :Zone.Identifier:$DATA), excluding the default ::$DATA
stream which the caller derives from the file size. Default: none.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".