Trait block_server::async_interface::Interface

source ·
pub trait Interface: Send + Sync + Unpin + 'static {
    // Required methods
    fn get_info(
        &self,
    ) -> impl Future<Output = Result<Cow<'_, PartitionInfo>, Status>> + Send;
    fn read(
        &self,
        device_block_offset: u64,
        block_count: u32,
        vmo: &Arc<Vmo>,
        vmo_offset: u64,
    ) -> impl Future<Output = Result<(), Status>> + Send;
    fn write(
        &self,
        device_block_offset: u64,
        block_count: u32,
        vmo: &Arc<Vmo>,
        vmo_offset: u64,
        opts: WriteOptions,
    ) -> impl Future<Output = Result<(), Status>> + Send;
    fn flush(&self) -> impl Future<Output = Result<(), Status>> + Send;
    fn trim(
        &self,
        device_block_offset: u64,
        block_count: u32,
    ) -> impl Future<Output = Result<(), Status>> + Send;

    // Provided methods
    fn on_attach_vmo(
        &self,
        _vmo: &Vmo,
    ) -> impl Future<Output = Result<(), Status>> + Send { ... }
    fn on_detach_vmo(&self, _vmo: &Vmo) { ... }
    fn get_volume_info(
        &self,
    ) -> impl Future<Output = Result<(VolumeManagerInfo, VolumeInfo), Status>> + Send { ... }
    fn query_slices(
        &self,
        _start_slices: &[u64],
    ) -> impl Future<Output = Result<Vec<VsliceRange>, Status>> + Send { ... }
    fn extend(
        &self,
        _start_slice: u64,
        _slice_count: u64,
    ) -> impl Future<Output = Result<(), Status>> + Send { ... }
    fn shrink(
        &self,
        _start_slice: u64,
        _slice_count: u64,
    ) -> impl Future<Output = Result<(), Status>> + Send { ... }
}

Required Methods§

source

fn get_info( &self, ) -> impl Future<Output = Result<Cow<'_, PartitionInfo>, Status>> + Send

Called to get partition information.

source

fn read( &self, device_block_offset: u64, block_count: u32, vmo: &Arc<Vmo>, vmo_offset: u64, ) -> impl Future<Output = Result<(), Status>> + Send

Called for a request to read bytes.

source

fn write( &self, device_block_offset: u64, block_count: u32, vmo: &Arc<Vmo>, vmo_offset: u64, opts: WriteOptions, ) -> impl Future<Output = Result<(), Status>> + Send

Called for a request to write bytes.

source

fn flush(&self) -> impl Future<Output = Result<(), Status>> + Send

Called to flush the device.

source

fn trim( &self, device_block_offset: u64, block_count: u32, ) -> impl Future<Output = Result<(), Status>> + Send

Called to trim a region.

Provided Methods§

source

fn on_attach_vmo( &self, _vmo: &Vmo, ) -> impl Future<Output = Result<(), Status>> + Send

Called whenever a VMO is attached, prior to the VMO’s usage in any other methods. Whilst the VMO is attached, vmo will keep the same address so it is safe to use the pointer value (as, say, a key into a HashMap).

source

fn on_detach_vmo(&self, _vmo: &Vmo)

Called whenever a VMO is detached.

source

fn get_volume_info( &self, ) -> impl Future<Output = Result<(VolumeManagerInfo, VolumeInfo), Status>> + Send

Called to handle the GetVolumeInfo FIDL call.

source

fn query_slices( &self, _start_slices: &[u64], ) -> impl Future<Output = Result<Vec<VsliceRange>, Status>> + Send

Called to handle the QuerySlices FIDL call.

source

fn extend( &self, _start_slice: u64, _slice_count: u64, ) -> impl Future<Output = Result<(), Status>> + Send

Called to handle the Extend FIDL call.

source

fn shrink( &self, _start_slice: u64, _slice_count: u64, ) -> impl Future<Output = Result<(), Status>> + Send

Called to handle the Shrink FIDL call.

Object Safety§

This trait is not object safe.

Implementors§