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§
fn open_file( &self, path: &str, flags: OpenFlags, direct: bool, ) -> Result<Arc<dyn File>>
fn remove_file(&self, path: &str) -> Result<()>
Provided Methods§
Whether this IO backend can back host-filesystem shared WAL coordination.
fn step(&self) -> Result<()>
fn cancel(&self, c: &[Completion]) -> Result<()>
Sourcefn drain_completions(&self, completions: &[Completion]) -> Result<()>
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.
fn wait_for_completion(&self, c: Completion) -> Result<()>
fn generate_random_number(&self) -> i64
Sourcefn fill_bytes(&self, dest: &mut [u8])
fn fill_bytes(&self, dest: &mut [u8])
Fill dest with random data.
fn get_memory_io(&self) -> Arc<MemoryIO> ⓘ
fn register_fixed_buffer(&self, _ptr: NonNull<u8>, _len: usize) -> Result<u32>
Sourcefn yield_now(&self)
fn yield_now(&self)
Yield the current thread to the scheduler. Used for backoff in contended lock acquisition.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".