pub trait AsyncDisk: DiskGetLen + FileSetLen + FileAllocate {
// Required methods
fn flush<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn fsync<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn fdatasync<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
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;
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;
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;
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;
// Provided methods
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 { ... }
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 { ... }
}
Expand description
An asynchronously accessible disk.
Required Methods§
sourcefn flush<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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.
sourcefn fsync<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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.
sourcefn fdatasync<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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.
sourcefn 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,
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
.
sourcefn 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,
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
.
Provided Methods§
sourcefn 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,
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
.
Less efficient than read_to_mem
because of extra copies and allocations.
sourcefn 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,
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
.
Less efficient than write_from_mem
because of extra copies and allocations.