pub struct AioContext { /* private fields */ }
Expand description
AioContext provides a submission queue for asycnronous I/O operations to block devices within the Linux kernel.
Implementations§
Source§impl AioContext
impl AioContext
Sourcepub fn new<E>(executor: &E, nr: usize) -> Result<AioContext, Error>
pub fn new<E>(executor: &E, nr: usize) -> Result<AioContext, Error>
Create a new AioContext that is driven by the provided event loop.
§Params
- executor: The executor used to spawn the background polling task
- nr: Number of submission slots for IO requests
Sourcepub fn read<ReadWriteHandle>(
&self,
fd: RawFd,
offset: u64,
buffer_obj: ReadWriteHandle,
) -> AioReadResultFuture<ReadWriteHandle>
pub fn read<ReadWriteHandle>( &self, fd: RawFd, offset: u64, buffer_obj: ReadWriteHandle, ) -> AioReadResultFuture<ReadWriteHandle>
Initiate an asynchronous read operation on the given file descriptor for reading data from the provided absolute file offset into the buffer. The buffer also determines the number of bytes to be read, which should be a multiple of the underlying device block size.
§Params:
- fd: The file descriptor of the file from which to read
- offset: The file offset where we want to read from
- buffer: A buffer to receive the read results
Sourcepub fn write<ReadOnlyHandle>(
&self,
fd: RawFd,
offset: u64,
buffer: ReadOnlyHandle,
) -> AioWriteResultFuture<ReadOnlyHandle>
pub fn write<ReadOnlyHandle>( &self, fd: RawFd, offset: u64, buffer: ReadOnlyHandle, ) -> AioWriteResultFuture<ReadOnlyHandle>
Initiate an asynchronous write operation on the given file descriptor for writing data to the provided absolute file offset from the buffer. The buffer also determines the number of bytes to be written, which should be a multiple of the underlying device block size.
§Params:
- fd: The file descriptor of the file to which to write
- offset: The file offset where we want to write to
- buffer: A buffer holding the data to be written
Sourcepub fn write_sync<ReadOnlyHandle>(
&self,
fd: RawFd,
offset: u64,
buffer_obj: ReadOnlyHandle,
sync_level: SyncLevel,
) -> AioWriteResultFuture<ReadOnlyHandle>
pub fn write_sync<ReadOnlyHandle>( &self, fd: RawFd, offset: u64, buffer_obj: ReadOnlyHandle, sync_level: SyncLevel, ) -> AioWriteResultFuture<ReadOnlyHandle>
Initiate an asynchronous write operation on the given file descriptor for writing data to the provided absolute file offset from the buffer. The buffer also determines the number of bytes to be written, which should be a multiple of the underlying device block size.
§Params:
- fd: The file descriptor of the file to which to write
- offset: The file offset where we want to write to
- buffer: A buffer holding the data to be written
- sync_level: A synchronization level to apply for this write operation
Sourcepub fn sync(&self, fd: RawFd) -> AioSyncResultFuture
pub fn sync(&self, fd: RawFd) -> AioSyncResultFuture
Initiate an asynchronous sync operation on the given file descriptor.
Caveat: While this operation is defined in the ABI, this command is known to
fail with an invalid argument error (EINVAL
) in many, if not all, cases. You are kind of
on your own.
§Params:
- fd: The file descriptor of the file to which to write
Sourcepub fn data_sync(&self, fd: RawFd) -> AioSyncResultFuture
pub fn data_sync(&self, fd: RawFd) -> AioSyncResultFuture
Initiate an asynchronous data sync operation on the given file descriptor.
Caveat: While this operation is defined in the ABI, this command is known to
fail with an invalid argument error (EINVAL
) in many, if not all, cases. You are kind of
on your own.
§Params:
- fd: The file descriptor of the file to which to write
Trait Implementations§
Source§impl Clone for AioContext
impl Clone for AioContext
Source§fn clone(&self) -> AioContext
fn clone(&self) -> AioContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more