Skip to main content

Mount

Trait Mount 

Source
pub trait Mount: Send + Sync {
    // Required methods
    fn walk<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        components: &'life1 [&'life2 str],
        caller: &'life3 Subject,
    ) -> Pin<Box<dyn Future<Output = Result<Fid, MountError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn open<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        fid: &'life1 mut Fid,
        mode: u8,
        caller: &'life2 Subject,
    ) -> Pin<Box<dyn Future<Output = Result<(), MountError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn read<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        fid: &'life1 Fid,
        offset: u64,
        count: u32,
        caller: &'life2 Subject,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, MountError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn write<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        fid: &'life1 Fid,
        offset: u64,
        data: &'life2 [u8],
        caller: &'life3 Subject,
    ) -> Pin<Box<dyn Future<Output = Result<u32, MountError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn readdir<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        fid: &'life1 Fid,
        caller: &'life2 Subject,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<DirEntry>, MountError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn stat<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        fid: &'life1 Fid,
        caller: &'life2 Subject,
    ) -> Pin<Box<dyn Future<Output = Result<Stat, MountError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn clunk<'life0, 'life1, 'async_trait>(
        &'life0 self,
        fid: Fid,
        caller: &'life1 Subject,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn create<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        _fid: &'life1 mut Fid,
        _name: &'life2 str,
        _perm: u32,
        _mode: u8,
        _caller: &'life3 Subject,
    ) -> Pin<Box<dyn Future<Output = Result<Stat, MountError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
    fn as_fsmount(&self) -> Option<&dyn FsMount> { ... }
}
Expand description

In-process mount backend. Implements 9P semantics without ZMQ/IPC.

Used for /config/, /private/, /bin/, /env/, and any other client-local namespace entries. Every method receives the verified Subject of the caller for per-tenant fid isolation and policy checks.

Required Methods§

Source

fn walk<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, components: &'life1 [&'life2 str], caller: &'life3 Subject, ) -> Pin<Box<dyn Future<Output = Result<Fid, MountError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Walk path components, returning an opaque fid.

Source

fn open<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, fid: &'life1 mut Fid, mode: u8, caller: &'life2 Subject, ) -> Pin<Box<dyn Future<Output = Result<(), MountError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Open a walked fid for I/O. mode: OREAD=0, OWRITE=1, ORDWR=2.

Source

fn read<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, fid: &'life1 Fid, offset: u64, count: u32, caller: &'life2 Subject, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, MountError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Read bytes from an open fid at offset.

Source

fn write<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, fid: &'life1 Fid, offset: u64, data: &'life2 [u8], caller: &'life3 Subject, ) -> Pin<Box<dyn Future<Output = Result<u32, MountError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Write bytes to an open fid at offset. Returns bytes written.

Source

fn readdir<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, fid: &'life1 Fid, caller: &'life2 Subject, ) -> Pin<Box<dyn Future<Output = Result<Vec<DirEntry>, MountError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Read directory entries from an open directory fid.

Source

fn stat<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, fid: &'life1 Fid, caller: &'life2 Subject, ) -> Pin<Box<dyn Future<Output = Result<Stat, MountError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Get file metadata.

Source

fn clunk<'life0, 'life1, 'async_trait>( &'life0 self, fid: Fid, caller: &'life1 Subject, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Release a fid.

Provided Methods§

Source

fn create<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _fid: &'life1 mut Fid, _name: &'life2 str, _perm: u32, _mode: u8, _caller: &'life3 Subject, ) -> Pin<Box<dyn Future<Output = Result<Stat, MountError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Create a new file or directory under a walked directory fid (9P Tcreate).

On success, fid is replaced by an opened fid on the new file (the directory fid is consumed, exactly as in 9P). perm carries the Unix mode bits; OR in DMDIR to create a directory. mode is the open mode for the newly created file (the new fid is opened writable).

§Default

Returns MountError::NotSupported. Read-only / synthetic mounts (the common case) inherit this default and remain writable-mount-free. Only the registry worktree mount (the writable upper layer of the union) overrides it — see RemoteRegistryMount::create.

§Copy-up

The union namespace performs copy-up before reaching here: a write to a path that exists only in a read-only lower layer is redirected to the writable upper layer, which may create the file first. See Namespace::echo / Namespace::create.

Source

fn as_fsmount(&self) -> Option<&dyn FsMount>

Capability downcast: report whether this mount is also a writable FsMount, returning a borrow if so.

The base Mount surface is read/write-on-existing-files only; full namespace mutation (create/unlink/mkdir/rename/…) lives on the FsMount supertrait. A Namespace stores every mount as Arc<dyn Mount>, erasing the richer type, so a consumer that holds only a dyn Mount (e.g. FS-A’s Namespace → FileSystem down-adapter) needs a way back to the FsMount vtable to route writes. This hook is the idiomatic capability-typed answer to “is this mount writable as a real filesystem?” — preferable to probing for NotSupported at runtime.

Default: None (a plain Mount is not a full filesystem). FsMount impls override this to return Some(self); the blanket impl in fsmount.rs is not possible (it would require Self: Sized), so each FsMount opts in with a one-line override.

Implementors§

Source§

impl Mount for StreamMount

Source§

impl Mount for SyntheticMount

Source§

impl<F> Mount for FuseFileSystemMount<F>
where F: FileSystem<Inode = u64, Handle = u64> + Send + Sync,