Skip to main content

Backend

Trait Backend 

Source
pub trait Backend: Send + Sync {
    // Required methods
    fn walk<'life0, 'life1, 'async_trait>(
        &'life0 self,
        fid: u32,
        newfid: u32,
        components: &'life1 [String],
    ) -> Pin<Box<dyn Future<Output = Result<WalkResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn open<'life0, 'async_trait>(
        &'life0 self,
        fid: u32,
        flags: u32,
    ) -> Pin<Box<dyn Future<Output = Result<OpenResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn read<'life0, 'async_trait>(
        &'life0 self,
        fid: u32,
        offset: u64,
        count: u32,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn write<'life0, 'life1, 'async_trait>(
        &'life0 self,
        fid: u32,
        offset: u64,
        data: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<u32>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn stat<'life0, 'async_trait>(
        &'life0 self,
        fid: u32,
    ) -> Pin<Box<dyn Future<Output = Result<StatResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn readdir<'life0, 'async_trait>(
        &'life0 self,
        fid: u32,
        offset: u64,
        count: u32,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn clunk<'life0, 'async_trait>(
        &'life0 self,
        fid: u32,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn attach<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _uname: &'life1 str,
        _aname: &'life2 str,
        verified: Option<VerifiedAttach>,
    ) -> Pin<Box<dyn Future<Output = Result<Option<VerifiedAttach>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn close_connection<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

9P filesystem backend.

All methods are async and Send-safe so the translator can drive them on a multi-threaded tokio runtime. Fid numbers are opaque to the backend — the translator allocates and tracks them; the backend sees a stable fid per walked path.

Required Methods§

Source

fn walk<'life0, 'life1, 'async_trait>( &'life0 self, fid: u32, newfid: u32, components: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<WalkResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Walk components from fid (the previously-walked parent, or the attach root). Allocates internal state for newfid.

Source

fn open<'life0, 'async_trait>( &'life0 self, fid: u32, flags: u32, ) -> Pin<Box<dyn Future<Output = Result<OpenResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Open fid with Linux-style flags (Tlopen). Returns the leaf qid and the negotiated iounit.

Source

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

Read up to count bytes from fid at offset.

Source

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

Write data to fid at offset. Returns the number of bytes written.

Source

fn stat<'life0, 'async_trait>( &'life0 self, fid: u32, ) -> Pin<Box<dyn Future<Output = Result<StatResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stat fid.

Source

fn readdir<'life0, 'async_trait>( &'life0 self, fid: u32, offset: u64, count: u32, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List directory entries under fid (a directory). The returned bytes are 9P readdir records; the translator passes them through verbatim.

Source

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

Release fid. Best-effort — errors are logged and ignored by the translator (the fid is dropped from its table regardless).

Provided Methods§

Source

fn attach<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _uname: &'life1 str, _aname: &'life2 str, verified: Option<VerifiedAttach>, ) -> Pin<Box<dyn Future<Output = Result<Option<VerifiedAttach>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Establish the session at Tattach, given the uname the client presented and the aname export selector it requested. The default is a no-op: backends whose caller identity is fixed at construction (the UDS/vsock listeners) ignore both.

A backend that resolves its caller identity from the attach itself (the H1b /9p WebTransport plane carries a mount ticket in Tattach.uname — the browser WebSocket can’t set headers and the cert-pinned WT session has no URL query) validates it here and binds the session Subject. aname is the requested export (the 9P attach name); an authorizing backend validates it against the ticket’s granted namespace and denies an unknown/forbidden/malformed selector rather than falling back to a default export (#877/#1071 fail-closed contract). Returning Err fails the attach; the translator maps it to an Rlerror errno (a hyprstream_vfs::MountError in the cause chain picks the errno — e.g. PermissionDenied → EACCES).

Source

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

Release connection-local handles after EOF or a framing/write error. Backends without retained remote handles may keep the default no-op.

Implementors§