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§
Sourcefn attach_vmo(
&self,
vmo: &Vmo,
) -> impl Future<Output = Result<VmoId, Status>> + Send
fn attach_vmo( &self, vmo: &Vmo, ) -> impl Future<Output = Result<VmoId, Status>> + Send
Wraps AttachVmo from fuchsia.hardware.block::Block.
Sourcefn detach_vmo(
&self,
vmo_id: VmoId,
) -> impl Future<Output = Result<(), Status>> + Send
fn detach_vmo( &self, vmo_id: VmoId, ) -> impl Future<Output = Result<(), Status>> + Send
Detaches the given vmo-id from the device.
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
Sourcefn barrier(&self)
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.
Sourcefn flush_traced(
&self,
trace_flow_id: u64,
) -> impl Future<Output = Result<(), Status>> + Send
fn flush_traced( &self, trace_flow_id: u64, ) -> impl Future<Output = Result<(), Status>> + Send
Sends a flush request to the underlying block device.
Sourcefn block_size(&self) -> u32
fn block_size(&self) -> u32
Returns the block size of the device.
Sourcefn block_count(&self) -> u64
fn block_count(&self) -> u64
Returns the size, in blocks, of the device.
Sourcefn max_transfer_blocks(&self) -> Option<NonZero<u32>>
fn max_transfer_blocks(&self) -> Option<NonZero<u32>>
Returns the maximum number of blocks which can be transferred in a single request.
Sourcefn block_flags(&self) -> BlockFlags
fn block_flags(&self) -> BlockFlags
Returns the block flags reported by the device.
Sourcefn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Returns true if the remote fifo is still connected.
Provided Methods§
Sourcefn read_at(
&self,
buffer_slice: MutableBufferSlice<'_>,
device_offset: u64,
) -> impl Future<Output = Result<(), Status>> + Send
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.
fn read_at_with_opts( &self, buffer_slice: MutableBufferSlice<'_>, device_offset: u64, opts: ReadOptions, ) -> impl Future<Output = Result<(), Status>> + Send
Sourcefn write_at(
&self,
buffer_slice: BufferSlice<'_>,
device_offset: u64,
) -> impl Future<Output = Result<(), Status>> + Send
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.
fn write_at_with_opts( &self, buffer_slice: BufferSlice<'_>, device_offset: u64, opts: WriteOptions, ) -> impl Future<Output = Result<(), Status>> + Send
Sourcefn trim(
&self,
device_range: Range<u64>,
) -> impl Future<Output = Result<(), Status>> + Send
fn trim( &self, device_range: Range<u64>, ) -> impl Future<Output = Result<(), Status>> + Send
Trims the given range on the block device.
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.