Skip to main content

Filesystem

Trait Filesystem 

Source
pub trait Filesystem {
    type Error: Into<Error>;

    // Required methods
    fn lookup<'life0, 'life1, 'async_trait>(
        &'life0 self,
        parent: u64,
        name: &'life1 OsStr,
    ) -> Pin<Box<dyn Future<Output = Result<FileAttr, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn getattr<'life0, 'async_trait>(
        &'life0 self,
        _ino: u64,
    ) -> Pin<Box<dyn Future<Output = Result<FileAttr, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn setattr<'life0, 'async_trait>(
        &'life0 mut self,
        ino: u64,
        size: Option<u64>,
    ) -> Pin<Box<dyn Future<Output = Result<FileAttr, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn readdir<'life0, 'async_trait>(
        &'life0 self,
        ino: u64,
        offset: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Iterator<Item = DirEntry> + Send + Sync + '_>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn read<'life0, 'async_trait>(
        &'life0 self,
        ino: u64,
        fh: u64,
        offset: i64,
        size: u32,
    ) -> Pin<Box<dyn Future<Output = Result<Bytes, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn write<'life0, 'async_trait>(
        &'life0 self,
        ino: u64,
        fh: u64,
        data: Bytes,
        offset: i64,
    ) -> Pin<Box<dyn Future<Output = Result<u32, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn create<'life0, 'async_trait>(
        &'life0 mut self,
        parent: u64,
        name: OsString,
        mode: u32,
        umask: u32,
        flags: i32,
    ) -> Pin<Box<dyn Future<Output = Result<(FileAttr, u64), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn mkdir<'life0, 'async_trait>(
        &'life0 mut self,
        parent: u64,
        name: OsString,
    ) -> Pin<Box<dyn Future<Output = Result<FileAttr, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn destroy<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
    fn open<'life0, 'async_trait>(
        &'life0 self,
        _ino: u64,
        _flags: i32,
    ) -> Pin<Box<dyn Future<Output = Result<u64, Self::Error>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
    fn release<'life0, 'async_trait>(
        &'life0 self,
        _ino: u64,
        _fh: u64,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
    fn inodes<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<BTreeSet<u64>, Self::Error>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Base trait providing asynchronous functions for the system calls.

WARNING: The crate::FilesystemFUSE struct encapsulates implementors in a RwLock. Therefore, care should be taken to not introduce deadlocks. An example would be if open waits on a release (e.g. to limit the number of open files), but the open acquires a write lock before any release.

Required Associated Types§

Required Methods§

Source

fn lookup<'life0, 'life1, 'async_trait>( &'life0 self, parent: u64, name: &'life1 OsStr, ) -> Pin<Box<dyn Future<Output = Result<FileAttr, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Lookup an entry by name in a directory. See also fuser::Filesystem::lookup.

Source

fn getattr<'life0, 'async_trait>( &'life0 self, _ino: u64, ) -> Pin<Box<dyn Future<Output = Result<FileAttr, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get attributes on an entry. See also fuser::Filesystem::getattr.

Source

fn setattr<'life0, 'async_trait>( &'life0 mut self, ino: u64, size: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<FileAttr, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set attributes. Currently only supports setting the size

Source

fn readdir<'life0, 'async_trait>( &'life0 self, ino: u64, offset: u64, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Iterator<Item = DirEntry> + Send + Sync + '_>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Read a directory. To be called repeatedly by specifying a gradually increasing offset, until the returned iterator is empty. A minimum of two calls is required to be certain that the end has been reached. offset represents the index of the starting element. See also fuser::Filesystem::readdir.

Source

fn read<'life0, 'async_trait>( &'life0 self, ino: u64, fh: u64, offset: i64, size: u32, ) -> Pin<Box<dyn Future<Output = Result<Bytes, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Read from a file. See also fuser::Filesystem::read.

Source

fn write<'life0, 'async_trait>( &'life0 self, ino: u64, fh: u64, data: Bytes, offset: i64, ) -> Pin<Box<dyn Future<Output = Result<u32, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Write to file. See also fuser::Filesystem::write.

Source

fn create<'life0, 'async_trait>( &'life0 mut self, parent: u64, name: OsString, mode: u32, umask: u32, flags: i32, ) -> Pin<Box<dyn Future<Output = Result<(FileAttr, u64), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create and open a file. See also fuser::Filesystem::create.

Source

fn mkdir<'life0, 'async_trait>( &'life0 mut self, parent: u64, name: OsString, ) -> Pin<Box<dyn Future<Output = Result<FileAttr, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create a directory. See also fuser::Filesystem::mkdir.

Provided Methods§

Source

fn destroy<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Close filesystem. See also fuser::Filesystem::destroy.

Source

fn open<'life0, 'async_trait>( &'life0 self, _ino: u64, _flags: i32, ) -> Pin<Box<dyn Future<Output = Result<u64, Self::Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Open a file and get a handle. See also fuser::Filesystem::open.

Source

fn release<'life0, 'async_trait>( &'life0 self, _ino: u64, _fh: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Release a file handle. See also fuser::Filesystem::release.

Source

fn inodes<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<BTreeSet<u64>, Self::Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get the set of inodes from the filesystem.

Implementors can usually provide a more efficient implementation than the blanket one, which performs BFS from the root.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: Filesystem + Send + Sync + 'static> Filesystem for Arc<RwLock<T>>

Source§

type Error = <T as Filesystem>::Error

Source§

fn destroy<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn lookup<'life0, 'life1, 'async_trait>( &'life0 self, parent: u64, name: &'life1 OsStr, ) -> Pin<Box<dyn Future<Output = Result<FileAttr, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn open<'life0, 'async_trait>( &'life0 self, ino: u64, flags: i32, ) -> Pin<Box<dyn Future<Output = Result<u64, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn release<'life0, 'async_trait>( &'life0 self, ino: u64, fh: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn getattr<'life0, 'async_trait>( &'life0 self, ino: u64, ) -> Pin<Box<dyn Future<Output = Result<FileAttr, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn setattr<'life0, 'async_trait>( &'life0 mut self, ino: u64, size: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<FileAttr, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn readdir<'life0, 'async_trait>( &'life0 self, ino: u64, offset: u64, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Iterator<Item = DirEntry> + Send + Sync + '_>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn read<'life0, 'async_trait>( &'life0 self, ino: u64, fh: u64, offset: i64, size: u32, ) -> Pin<Box<dyn Future<Output = Result<Bytes, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn write<'life0, 'async_trait>( &'life0 self, ino: u64, fh: u64, data: Bytes, offset: i64, ) -> Pin<Box<dyn Future<Output = Result<u32, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn create<'life0, 'async_trait>( &'life0 mut self, parent: u64, name: OsString, mode: u32, umask: u32, flags: i32, ) -> Pin<Box<dyn Future<Output = Result<(FileAttr, u64), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn mkdir<'life0, 'async_trait>( &'life0 mut self, parent: u64, name: OsString, ) -> Pin<Box<dyn Future<Output = Result<FileAttr, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn inodes<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<BTreeSet<u64>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§