pub trait BlockService: Send + Sync {
// Required methods
fn allocate_buffer(&self, max_len: usize) -> OwnedBuffer;
fn read_blocks(
&self,
device_offset: u64,
dest_buffer: OwnedBuffer,
on_complete: Box<dyn FnOnce(Result<OwnedBuffer, Error>) + Send>,
) -> Result<(), Error>;
}Expand description
Interface for block storage services providing read buffers and block read operations.
Required Methods§
Sourcefn allocate_buffer(&self, max_len: usize) -> OwnedBuffer
fn allocate_buffer(&self, max_len: usize) -> OwnedBuffer
Allocates a read buffer of at most max_len bytes (OwnedBuffer).
max_len must be greater than zero. Implementations must guarantee that the returned
buffer satisfies 0 < buffer.len() <= max_len and that buffer.len() is a multiple of
BLOCK_SIZE.
Sourcefn read_blocks(
&self,
device_offset: u64,
dest_buffer: OwnedBuffer,
on_complete: Box<dyn FnOnce(Result<OwnedBuffer, Error>) + Send>,
) -> Result<(), Error>
fn read_blocks( &self, device_offset: u64, dest_buffer: OwnedBuffer, on_complete: Box<dyn FnOnce(Result<OwnedBuffer, Error>) + Send>, ) -> Result<(), Error>
Submits a read for the specified range from device_offset into dest_buffer.
When the read completes, on_complete is invoked with the result containing the buffer.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".