Skip to main content

OptimizedFs

Trait OptimizedFs 

Source
pub trait OptimizedFs {
    // Required methods
    fn optimized_copy(
        &mut self,
        src: PathBuf,
        dst: PathBuf,
        src_file_size: u64,
        target_label: String,
        buffer_limit: Option<usize>,
        skip_fsync: bool,
        is_sparse: bool,
    ) -> impl Future<Output = Result<CopyStats>> + Send;
    fn optimized_copy_range(
        &mut self,
        src: PathBuf,
        dst: PathBuf,
        offset: u64,
        length: u64,
        src_file_size: u64,
        target_label: String,
        buffer_limit: Option<usize>,
        skip_fsync: bool,
    ) -> impl Future<Output = Result<CopyStats>> + Send;
    fn optimized_truncate(
        &mut self,
        dst: PathBuf,
        size: u64,
    ) -> impl Future<Output = Result<CopyStats>> + Send;
    fn optimized_rename(
        &mut self,
        src: PathBuf,
        dst: PathBuf,
        flags: u32,
    ) -> impl Future<Output = Result<CopyStats>> + Send;
    fn optimized_fallocate(
        &mut self,
        dst: PathBuf,
        mode: i32,
        offset: u64,
        length: u64,
    ) -> impl Future<Output = Result<CopyStats>> + Send;
    fn optimized_unlink(
        &mut self,
        path: PathBuf,
        is_dir: bool,
    ) -> impl Future<Output = Result<CopyStats>> + Send;
    fn optimized_link(
        &mut self,
        existing: PathBuf,
        new: PathBuf,
    ) -> impl Future<Output = Result<CopyStats>> + Send;
    fn optimized_symlink(
        &mut self,
        target: PathBuf,
        linkpath: PathBuf,
    ) -> impl Future<Output = Result<CopyStats>> + Send;
}
Expand description

Trait for filesystem operations that auto-select the optimal I/O path

Required Methods§

Source

fn optimized_copy( &mut self, src: PathBuf, dst: PathBuf, src_file_size: u64, target_label: String, buffer_limit: Option<usize>, skip_fsync: bool, is_sparse: bool, ) -> impl Future<Output = Result<CopyStats>> + Send

Copy an entire file, choosing reflink/sendfile/io_uring as appropriate

Source

fn optimized_copy_range( &mut self, src: PathBuf, dst: PathBuf, offset: u64, length: u64, src_file_size: u64, target_label: String, buffer_limit: Option<usize>, skip_fsync: bool, ) -> impl Future<Output = Result<CopyStats>> + Send

Copy a byte range within a file (used for Merkle delta resync)

Source

fn optimized_truncate( &mut self, dst: PathBuf, size: u64, ) -> impl Future<Output = Result<CopyStats>> + Send

Truncate a file to the given size

Source

fn optimized_rename( &mut self, src: PathBuf, dst: PathBuf, flags: u32, ) -> impl Future<Output = Result<CopyStats>> + Send

Rename a file with optional flags (e.g. RENAME_EXCHANGE)

Source

fn optimized_fallocate( &mut self, dst: PathBuf, mode: i32, offset: u64, length: u64, ) -> impl Future<Output = Result<CopyStats>> + Send

Allocate or punch holes in a file

Unlink a file or remove a directory via io_uring UnlinkAt (AT_REMOVEDIR for dirs). Falls back to spawn_blocking on EOPNOTSUPP.

Create a hard link via io_uring LinkAt. Falls back to spawn_blocking on EOPNOTSUPP.

Create a symbolic link via io_uring SymlinkAt. Falls back to spawn_blocking on EOPNOTSUPP.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§