pub struct FileIO { /* private fields */ }Expand description
A File-like value that can perform async read_at and write_at for I/O at specific offsets without mutating any state (i.e. is thread safe). Metrics are collected, and syncs can be delayed for write batching opportunities as a performance optimisation.
Implementations§
Source§impl FileIO
 
impl FileIO
Sourcepub async fn open(path: &Path, flags: i32) -> Self
 
pub async fn open(path: &Path, flags: i32) -> 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.
If the mmap feature is being used, 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). 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.