Skip to main content

DurableFile

Trait DurableFile 

Source
pub trait DurableFile:
    Write
    + Send
    + Sync
    + Debug {
    // Required methods
    fn sync_data(&self) -> Result<()>;
    fn sync_all(&self) -> Result<()>;
    fn set_len(&self, size: u64) -> Result<()>;
}
Expand description

A file a durable path appends to.

Write plus the three file operations a rewind needs. Boxed behind a BufWriter where there is one, so the dynamic call happens once per buffer flush rather than once per record.

Required Methods§

Source

fn sync_data(&self) -> Result<()>

Flush the file’s data to stable storage.

§Errors

The underlying fsync error. A failure here is not recoverable by retrying: on a failed fsync the kernel may discard the dirty pages and clear the error, so a second call can succeed while the data is gone. The caller poisons itself instead.

Source

fn sync_all(&self) -> Result<()>

Flush the file’s data and metadata to stable storage.

§Errors

The underlying fsync error.

Source

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

Truncate or extend the file to size bytes.

§Errors

The underlying ftruncate error.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl DurableFile for File

Source§

fn sync_data(&self) -> Result<()>

Source§

fn sync_all(&self) -> Result<()>

Source§

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

Implementors§