pub trait File: Debug + Send + Sync + Seek + Read + Write + 'static {
    fn id(&self) -> Option<u64>;
fn path(&self) -> &Path;
fn length(&self) -> Result<u64, Error>;
fn synchronize(&mut self) -> Result<(), Error>;
fn close(self) -> Result<(), Error>; }
Expand description

A generic file trait.

Required methods

Returns the unique ID of this file. Only unique within the manager it was opened from.

Returns the path to the file.

Returns the length of the file.

Synchronizes data and metadata to the final destination. This calls std::fs::File::sync_all() on files, which ensures all filesystem metadata (such as newly allocated blocks) and data is synchronized to the destination device.

Safely closes the file after flushing any pending operations to disk.