Skip to main content

File

Trait File 

Source
pub trait File: Send + Sync {
Show 15 methods // Required methods fn lock_file(&self, exclusive: bool) -> Result<()>; fn unlock_file(&self) -> Result<()>; fn pread(&self, pos: u64, c: Completion) -> Result<Completion>; fn pwrite( &self, pos: u64, buffer: Arc<Buffer>, c: Completion, ) -> Result<Completion>; fn sync(&self, c: Completion, sync_type: FileSyncType) -> Result<Completion>; fn size(&self) -> Result<u64>; fn truncate(&self, len: u64, c: Completion) -> Result<Completion>; // Provided methods fn pwritev( &self, pos: u64, buffers: Vec<Arc<Buffer>>, c: Completion, ) -> Result<Completion> { ... } fn has_hole(&self, _pos: usize, _len: usize) -> Result<bool> { ... } fn punch_hole(&self, _pos: usize, _len: usize) -> Result<()> { ... } fn shared_wal_lock_byte( &self, _offset: u64, _exclusive: bool, _kind: SharedWalLockKind, ) -> Result<()> { ... } fn shared_wal_try_lock_byte( &self, _offset: u64, _exclusive: bool, _kind: SharedWalLockKind, ) -> Result<bool> { ... } fn shared_wal_unlock_byte( &self, _offset: u64, _kind: SharedWalLockKind, ) -> Result<()> { ... } fn shared_wal_set_len(&self, _len: u64) -> Result<()> { ... } fn shared_wal_map( &self, _offset: u64, _len: usize, ) -> Result<Box<dyn SharedWalMappedRegion>> { ... }
}

Required Methods§

Source

fn lock_file(&self, exclusive: bool) -> Result<()>

Source

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

Source

fn pread(&self, pos: u64, c: Completion) -> Result<Completion>

Source

fn pwrite( &self, pos: u64, buffer: Arc<Buffer>, c: Completion, ) -> Result<Completion>

Source

fn sync(&self, c: Completion, sync_type: FileSyncType) -> Result<Completion>

Sync file data&metadata to disk.

Source

fn size(&self) -> Result<u64>

Source

fn truncate(&self, len: u64, c: Completion) -> Result<Completion>

Provided Methods§

Source

fn pwritev( &self, pos: u64, buffers: Vec<Arc<Buffer>>, c: Completion, ) -> Result<Completion>

Source

fn has_hole(&self, _pos: usize, _len: usize) -> Result<bool>

Optional method implemented by the IO which supports “partial” files (e.g. file with “holes”) This method is used in sync engine only for now (in partial sync mode) and never used in the core database code

The hole is the contiguous file region which is not allocated by the file-system If there is a single byte which is allocated within a given range - method must return false in this case

Source

fn punch_hole(&self, _pos: usize, _len: usize) -> Result<()>

Optional method implemented by the IO which supports “partial” files (e.g. file with “holes”) This method is used in sync engine only for now (in partial sync mode) and never used in the core database code

Source

fn shared_wal_lock_byte( &self, _offset: u64, _exclusive: bool, _kind: SharedWalLockKind, ) -> Result<()>

Source

fn shared_wal_try_lock_byte( &self, _offset: u64, _exclusive: bool, _kind: SharedWalLockKind, ) -> Result<bool>

Source

fn shared_wal_unlock_byte( &self, _offset: u64, _kind: SharedWalLockKind, ) -> Result<()>

Source

fn shared_wal_set_len(&self, _len: u64) -> Result<()>

Source

fn shared_wal_map( &self, _offset: u64, _len: usize, ) -> Result<Box<dyn SharedWalMappedRegion>>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl File for VfsFileImpl

Source§

fn lock_file(&self, exclusive: bool) -> Result<()>

Source§

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

Source§

fn pread(&self, pos: u64, c: Completion) -> Result<Completion>

Source§

fn pwrite( &self, pos: u64, buffer: Arc<Buffer>, c: Completion, ) -> Result<Completion>

Source§

fn sync(&self, c: Completion, _sync_type: FileSyncType) -> Result<Completion>

Source§

fn size(&self) -> Result<u64>

Source§

fn truncate(&self, len: u64, c: Completion) -> Result<Completion>

Implementors§