pub struct AsyncDiskFileWrapper<T: DiskFile + Send> {
    blocking_pool: BlockingPool,
    inner: Arc<T>,
}
Expand description

Async wrapper around a non-async DiskFile using a BlockingPool.

This is meant to be a transitional type, not a long-term solution for async disk support. Disk formats should be migrated to support async instead (b/219595052).

Fields§

§blocking_pool: BlockingPool§inner: Arc<T>

Implementations§

source§

impl<T: DiskFile + Send> AsyncDiskFileWrapper<T>

source

pub fn new(disk_file: T, _ex: &Executor) -> Self

Trait Implementations§

source§

impl<T: DiskFile + Send> AsRawDescriptors for AsyncDiskFileWrapper<T>

source§

fn as_raw_descriptors(&self) -> Vec<RawDescriptor>

Returns the underlying raw descriptors. Read more
source§

impl<T: 'static + DiskFile + DiskFlush + Send + Sync + FileAllocate + FileSetLen + FileSync + PunchHole + WriteZeroesAt> AsyncDisk for AsyncDiskFileWrapper<T>

source§

fn flush<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Flush intermediary buffers and/or dirty state to file. fsync not required.
source§

fn fsync<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Asynchronously fsyncs any completed operations to the disk.
source§

fn fdatasync<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Asynchronously fdatasyncs any completed operations to the disk. Note that an implementation may simply call fsync for fdatasync.
source§

fn read_to_mem<'a, 'async_trait>( &'a self, file_offset: u64, mem: Arc<dyn BackingMemory + Send + Sync>, mem_offsets: MemRegionIter<'a> ) -> Pin<Box<dyn Future<Output = Result<usize>> + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Reads from the file at ‘file_offset’ into memory mem at mem_offsets. mem_offsets is similar to an iovec except relative to the start of mem.
source§

fn write_from_mem<'a, 'async_trait>( &'a self, file_offset: u64, mem: Arc<dyn BackingMemory + Send + Sync>, mem_offsets: MemRegionIter<'a> ) -> Pin<Box<dyn Future<Output = Result<usize>> + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Writes to the file at ‘file_offset’ from memory mem at mem_offsets.
source§

fn punch_hole<'life0, 'async_trait>( &'life0 self, file_offset: u64, length: u64 ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Replaces a range of bytes with a hole.
source§

fn write_zeroes_at<'life0, 'async_trait>( &'life0 self, file_offset: u64, length: u64 ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Writes up to length bytes of zeroes to the stream, returning how many bytes were written.
source§

fn read_double_buffered<'life0, 'life1, 'async_trait>( &'life0 self, file_offset: u64, buf: &'life1 mut [u8] ) -> Pin<Box<dyn Future<Output = Result<usize>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Reads from the file at ‘file_offset’ into buf. Read more
source§

fn write_double_buffered<'life0, 'life1, 'async_trait>( &'life0 self, file_offset: u64, buf: &'life1 [u8] ) -> Pin<Box<dyn Future<Output = Result<usize>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Writes to the file at ‘file_offset’ from buf. Read more
source§

impl<T: DiskFile + Send> DiskGetLen for AsyncDiskFileWrapper<T>

source§

fn get_len(&self) -> Result<u64>

Get the current length of the disk in bytes.
source§

impl<T: DiskFile + Send + FileAllocate> FileAllocate for AsyncDiskFileWrapper<T>

source§

fn allocate(&self, offset: u64, len: u64) -> Result<()>

Allocate storage for the region of the file starting at offset and extending len bytes.
source§

impl<T: DiskFile + Send + FileSetLen> FileSetLen for AsyncDiskFileWrapper<T>

source§

fn set_len(&self, len: u64) -> Result<()>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for AsyncDiskFileWrapper<T>
where T: RefUnwindSafe,

§

impl<T> Send for AsyncDiskFileWrapper<T>
where T: Sync,

§

impl<T> Sync for AsyncDiskFileWrapper<T>
where T: Sync,

§

impl<T> Unpin for AsyncDiskFileWrapper<T>

§

impl<T> UnwindSafe for AsyncDiskFileWrapper<T>
where T: RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.