Expand description
Platform-abstracted non-blocking storage I/O for Ring 0.
§Storage I/O Abstraction
Platform-abstracted non-blocking storage I/O for the thread-per-core architecture.
§Design
Ring 0 cannot block, allocate, or syscall on the hot path. Storage I/O needs a submission-completion model that fits the synchronous spin-loop:
- Submit: push a write or sync request (non-blocking)
- Poll: check for completions on the next loop iteration
Two backends implement this interface:
-
SyncStorageIo— executes I/O inline viastd::fs. Write “completes” when data is in the kernel page cache. Sync “completes” afterfdatasync. Works on all platforms. This is the default. -
UringStorageIo(Linux +io-uringfeature) — submits SQEs to a per-core ring. With SQPOLL, submissions are zero-syscall. Completions arrive via CQE polling.
§Usage from Ring 0
// Cold path (init_core_thread):
let storage = SyncStorageIo::new();
let wal_fd = storage.register_fd(file);
// Hot path (core_thread_main loop):
storage.submit_write(fd, &data, offset)?;
storage.flush()?;
// ... next iteration ...
completions.clear();
storage.poll_completions(&mut completions);Structs§
- IoCompletion
- Completion of a submitted I/O operation.
- IoFd
- Opaque file descriptor managed by a
StorageIobackend. - Sync
Storage Io - Synchronous storage I/O backend.
- Uring
Storage Io io_uringstorage I/O backend.
Enums§
- Storage
IoError - Errors from the storage I/O layer.
Traits§
- Storage
Io - Non-blocking storage I/O backend for Ring 0.