Struct seekable_async_file::SeekableAsyncFile
source · pub struct SeekableAsyncFile { /* private fields */ }
Implementations§
source§impl SeekableAsyncFile
impl SeekableAsyncFile
sourcepub async fn open(
path: &Path,
size: u64,
metrics: Arc<SeekableAsyncFileMetrics>,
delayed_sync_us: u64,
io_direct: bool,
io_dsync: bool
) -> Self
pub async fn open(
path: &Path,
size: u64,
metrics: Arc<SeekableAsyncFileMetrics>,
delayed_sync_us: u64,
io_direct: bool,
io_dsync: bool
) -> Self
Open a file descriptor in read and write modes, creating it if it doesn’t exist. If it already exists, the contents won’t be truncated.
To save a stat
call, the size must be provided. This also allows opening non-standard files which may have a size of zero (e.g. block devices). If the mmap feature is being used, a different size value also allows only using a portion of the beginning of the file.
The io_direct
and io_dsync
parameters set the O_DIRECT
and O_DSYNC
flags, respectively. Unless you need those flags, provide false
.
Make sure to execute start_delayed_data_sync_background_loop
in the background after this call.
pub async fn read_at(&self, offset: u64, len: u64) -> Vec<u8>
pub async fn read_u16_at(&self, offset: u64) -> u16
pub async fn read_u64_at(&self, offset: u64) -> u64
pub async fn write_at(&self, offset: u64, data: Vec<u8>)
pub async fn write_at_with_delayed_sync(&self, writes: Vec<WriteRequest>)
pub async fn start_delayed_data_sync_background_loop(&self)
pub async fn sync_data(&self)
Trait Implementations§
source§impl Clone for SeekableAsyncFile
impl Clone for SeekableAsyncFile
source§fn clone(&self) -> SeekableAsyncFile
fn clone(&self) -> SeekableAsyncFile
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more