Skip to main content

IO

Trait IO 

Source
pub trait IO:
    Clock
    + Send
    + Sync {
Show 15 methods // Required methods fn open_file( &self, path: &str, flags: OpenFlags, direct: bool, ) -> Result<Arc<dyn File>>; fn remove_file(&self, path: &str) -> Result<()>; // Provided methods fn open_shared_wal_file(&self, path: &str) -> Result<Arc<dyn File>> { ... } fn supports_shared_wal_coordination(&self) -> bool { ... } fn step(&self) -> Result<()> { ... } fn cancel(&self, c: &[Completion]) -> Result<()> { ... } fn drain_completions(&self, completions: &[Completion]) -> Result<()> { ... } fn wait_for_completion(&self, c: Completion) -> Result<()> { ... } fn generate_random_number(&self) -> i64 { ... } fn fill_bytes(&self, dest: &mut [u8]) { ... } fn get_memory_io(&self) -> Arc<MemoryIO> { ... } fn register_fixed_buffer( &self, _ptr: NonNull<u8>, _len: usize, ) -> Result<u32> { ... } fn yield_now(&self) { ... } fn sleep(&self, duration: Duration) { ... } fn file_id(&self, path: &str) -> Result<FileId> { ... }
}

Required Methods§

Source

fn open_file( &self, path: &str, flags: OpenFlags, direct: bool, ) -> Result<Arc<dyn File>>

Source

fn remove_file(&self, path: &str) -> Result<()>

Provided Methods§

Source

fn open_shared_wal_file(&self, path: &str) -> Result<Arc<dyn File>>

Source

fn supports_shared_wal_coordination(&self) -> bool

Whether this IO backend can back host-filesystem shared WAL coordination.

Source

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

Source

fn cancel(&self, c: &[Completion]) -> Result<()>

Source

fn drain_completions(&self, completions: &[Completion]) -> Result<()>

Drive the IO backend until each completion in completions is finished(). Used after cancel() (so cancelled ops actually release their buffers before the caller returns) and after a single pwrite/pwritev/sync that the caller wants to await synchronously.

Unlike a global “drain the ring” barrier, this only waits on the completions the caller passes in. Other threads can keep submitting concurrently — their work doesn’t extend or interfere with this call. Completion::finished() is monotonic (OnceLock-backed), so the loop will terminate as soon as every caller-owned completion has had its CQE processed.

Source

fn wait_for_completion(&self, c: Completion) -> Result<()>

Source

fn generate_random_number(&self) -> i64

Source

fn fill_bytes(&self, dest: &mut [u8])

Fill dest with random data.

Source

fn get_memory_io(&self) -> Arc<MemoryIO>

Source

fn register_fixed_buffer(&self, _ptr: NonNull<u8>, _len: usize) -> Result<u32>

Source

fn yield_now(&self)

Yield the current thread to the scheduler. Used for backoff in contended lock acquisition.

Source

fn sleep(&self, duration: Duration)

Sleep for the specified duration. Used for progressive backoff in contended lock acquisition.

Source

fn file_id(&self, path: &str) -> Result<FileId>

Return the file identity for the given path. Default uses OS-level metadata; non-filesystem backends override with synthetic hash-based identity.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§