pub struct FakeBlockClient { /* private fields */ }
Expand description
A fake instance of BlockClient for use in tests.
Implementations§
Trait Implementations§
Source§impl BlockClient for FakeBlockClient
impl BlockClient for FakeBlockClient
Source§async fn attach_vmo(&self, vmo: &Vmo) -> Result<VmoId, Status>
async fn attach_vmo(&self, vmo: &Vmo) -> Result<VmoId, Status>
Wraps AttachVmo from fuchsia.hardware.block::Block.
Source§async fn detach_vmo(&self, vmo_id: VmoId) -> Result<(), Status>
async fn detach_vmo(&self, vmo_id: VmoId) -> Result<(), Status>
Detaches the given vmo-id from the device.
async fn read_at_with_opts_traced( &self, buffer_slice: MutableBufferSlice<'_>, device_offset: u64, _opts: ReadOptions, _trace_flow_id: u64, ) -> Result<(), Status>
async fn write_at_with_opts_traced( &self, buffer_slice: BufferSlice<'_>, device_offset: u64, _opts: WriteOptions, _trace_flow_id: u64, ) -> Result<(), Status>
async fn trim_traced( &self, range: Range<u64>, _trace_flow_id: u64, ) -> Result<(), Status>
Source§async fn flush_traced(&self, _trace_flow_id: u64) -> Result<(), Status>
async fn flush_traced(&self, _trace_flow_id: u64) -> Result<(), Status>
Sends a flush request to the underlying block device.
Source§fn 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.Source§fn block_size(&self) -> u32
fn block_size(&self) -> u32
Returns the block size of the device.
Source§fn block_count(&self) -> u64
fn block_count(&self) -> u64
Returns the size, in blocks, of the device.
Source§fn 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.
Source§fn block_flags(&self) -> Flag
fn block_flags(&self) -> Flag
Returns the block flags reported by the device.
Source§fn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Returns true if the remote fifo is still connected.
Source§fn 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
Source§fn 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
Source§fn 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
Auto Trait Implementations§
impl !Freeze for FakeBlockClient
impl !RefUnwindSafe for FakeBlockClient
impl Send for FakeBlockClient
impl Sync for FakeBlockClient
impl Unpin for FakeBlockClient
impl UnwindSafe for FakeBlockClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more