Skip to main content

FuseRequestHandler

Trait FuseRequestHandler 

Source
pub trait FuseRequestHandler: Send + Sync {
    // Required method
    fn handle_request(&self, request: &[u8]) -> Result<Vec<u8>, VirtioError>;

    // Provided methods
    fn on_init(&self, _session: &FuseSession) { ... }
    fn on_destroy(&self) { ... }
}
Expand description

Trait for handling FUSE requests.

This trait is implemented by arcbox-fs::FsServer to process FUSE filesystem operations. The VirtioFs device dispatches requests to this handler.

§Example

use arcbox_virtio::fs::{FuseRequestHandler, FuseRequest, FuseResponse};

struct MyFsHandler;

impl FuseRequestHandler for MyFsHandler {
    fn handle_request(&self, request: &[u8]) -> arcbox_virtio_core::error::Result<Vec<u8>> {
        // Process FUSE request and return response
        Ok(FuseResponse::new(0, vec![]).into_data())
    }
}

Required Methods§

Source

fn handle_request(&self, request: &[u8]) -> Result<Vec<u8>, VirtioError>

Handles a FUSE request and returns the response.

The request contains the raw FUSE protocol bytes from the guest. The handler should parse, process, and return the response bytes.

Provided Methods§

Source

fn on_init(&self, _session: &FuseSession)

Called when the FUSE session is initialized.

This is invoked after the FUSE_INIT handshake completes successfully.

Source

fn on_destroy(&self)

Called when the FUSE session is destroyed.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§