Trait BlockClient

Source
pub trait BlockClient: Send + Sync {
Show 19 methods // Required methods fn attach_vmo( &self, vmo: &Vmo, ) -> impl Future<Output = Result<VmoId, Status>> + Send; fn detach_vmo( &self, vmo_id: VmoId, ) -> impl Future<Output = Result<(), Status>> + Send; fn read_at_with_opts_traced( &self, buffer_slice: MutableBufferSlice<'_>, device_offset: u64, opts: ReadOptions, trace_flow_id: u64, ) -> impl Future<Output = Result<(), Status>> + Send; fn write_at_with_opts_traced( &self, buffer_slice: BufferSlice<'_>, device_offset: u64, opts: WriteOptions, trace_flow_id: u64, ) -> impl Future<Output = Result<(), Status>> + Send; fn trim_traced( &self, device_range: Range<u64>, trace_flow_id: u64, ) -> impl Future<Output = Result<(), Status>> + Send; fn barrier(&self); fn flush_traced( &self, trace_flow_id: u64, ) -> impl Future<Output = Result<(), Status>> + Send; fn close(&self) -> impl Future<Output = Result<(), Status>> + Send; fn block_size(&self) -> u32; fn block_count(&self) -> u64; fn max_transfer_blocks(&self) -> Option<NonZero<u32>>; fn block_flags(&self) -> BlockFlags; fn is_connected(&self) -> bool; // Provided methods fn read_at( &self, buffer_slice: MutableBufferSlice<'_>, device_offset: u64, ) -> impl Future<Output = Result<(), Status>> + Send { ... } fn read_at_with_opts( &self, buffer_slice: MutableBufferSlice<'_>, device_offset: u64, opts: ReadOptions, ) -> impl Future<Output = Result<(), Status>> + Send { ... } fn write_at( &self, buffer_slice: BufferSlice<'_>, device_offset: u64, ) -> impl Future<Output = Result<(), Status>> + Send { ... } fn write_at_with_opts( &self, buffer_slice: BufferSlice<'_>, device_offset: u64, opts: WriteOptions, ) -> impl Future<Output = Result<(), Status>> + Send { ... } fn trim( &self, device_range: Range<u64>, ) -> impl Future<Output = Result<(), Status>> + Send { ... } fn flush(&self) -> impl Future<Output = Result<(), Status>> + Send { ... }
}
Expand description

Represents a client connection to a block device. This is a simplified version of the block.fidl interface. Most users will use the RemoteBlockClient instantiation of this trait.

Required Methods§

Source

fn attach_vmo( &self, vmo: &Vmo, ) -> impl Future<Output = Result<VmoId, Status>> + Send

Wraps AttachVmo from fuchsia.hardware.block::Block.

Source

fn detach_vmo( &self, vmo_id: VmoId, ) -> impl Future<Output = Result<(), Status>> + Send

Detaches the given vmo-id from the device.

Source

fn read_at_with_opts_traced( &self, buffer_slice: MutableBufferSlice<'_>, device_offset: u64, opts: ReadOptions, trace_flow_id: u64, ) -> impl Future<Output = Result<(), Status>> + Send

Source

fn write_at_with_opts_traced( &self, buffer_slice: BufferSlice<'_>, device_offset: u64, opts: WriteOptions, trace_flow_id: u64, ) -> impl Future<Output = Result<(), Status>> + Send

Source

fn trim_traced( &self, device_range: Range<u64>, trace_flow_id: u64, ) -> impl Future<Output = Result<(), Status>> + Send

Source

fn barrier(&self)

Attaches a barrier to the next write sent to the underlying block device. This barrier method is an alternative to setting the WriteOption::PRE_BARRIER on write_at_with_opts. This method makes it easier to guarantee that the barrier is attached to the correct write operation when subsequent write operations can get reordered.

Source

fn flush_traced( &self, trace_flow_id: u64, ) -> impl Future<Output = Result<(), Status>> + Send

Sends a flush request to the underlying block device.

Source

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

Closes the fifo.

Source

fn block_size(&self) -> u32

Returns the block size of the device.

Source

fn block_count(&self) -> u64

Returns the size, in blocks, of the device.

Source

fn max_transfer_blocks(&self) -> Option<NonZero<u32>>

Returns the maximum number of blocks which can be transferred in a single request.

Source

fn block_flags(&self) -> BlockFlags

Returns the block flags reported by the device.

Source

fn is_connected(&self) -> bool

Returns true if the remote fifo is still connected.

Provided Methods§

Source

fn read_at( &self, buffer_slice: MutableBufferSlice<'_>, device_offset: u64, ) -> impl Future<Output = Result<(), Status>> + Send

Reads from the device at |device_offset| into the given buffer slice.

Source

fn read_at_with_opts( &self, buffer_slice: MutableBufferSlice<'_>, device_offset: u64, opts: ReadOptions, ) -> impl Future<Output = Result<(), Status>> + Send

Source

fn write_at( &self, buffer_slice: BufferSlice<'_>, device_offset: u64, ) -> impl Future<Output = Result<(), Status>> + Send

Writes the data in |buffer_slice| to the device.

Source

fn write_at_with_opts( &self, buffer_slice: BufferSlice<'_>, device_offset: u64, opts: WriteOptions, ) -> impl Future<Output = Result<(), Status>> + Send

Source

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

Trims the given range on the block device.

Source

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§