pub struct AsyncBlockService<I: Interface> { /* private fields */ }Expand description
A generic adapter that presents any [async_interface::Interface] backend as a
BlockService, using BufferAllocator for concurrent read buffer management and
fasync::ScopeHandle for thread-safe task spawning.
Implementations§
Source§impl<I: Interface> AsyncBlockService<I>
impl<I: Interface> AsyncBlockService<I>
pub async fn new( interface: Arc<I>, block_size: u32, pool_capacity: usize, scope: ScopeHandle, ) -> Result<Self, Status>
pub fn new_with_allocator( interface: Arc<I>, block_size: u32, allocator: Arc<BufferAllocator>, scope: ScopeHandle, ) -> Self
pub fn interface(&self) -> &Arc<I> ⓘ
pub fn allocator(&self) -> &Arc<BufferAllocator> ⓘ
Trait Implementations§
Source§impl<I: Interface> BlockService for AsyncBlockService<I>
impl<I: Interface> BlockService for AsyncBlockService<I>
Source§fn allocate_buffer(&self, max_len: usize) -> OwnedBuffer
fn allocate_buffer(&self, max_len: usize) -> OwnedBuffer
Source§fn 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.Auto Trait Implementations§
impl<I> !RefUnwindSafe for AsyncBlockService<I>
impl<I> !UnwindSafe for AsyncBlockService<I>
impl<I> Freeze for AsyncBlockService<I>
impl<I> Send for AsyncBlockService<I>
impl<I> Sync for AsyncBlockService<I>
impl<I> Unpin for AsyncBlockService<I>
impl<I> UnsafeUnpin for AsyncBlockService<I>
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
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more