Module uring

Module uring 

Source
Expand description

Core io_uring wrapper providing async file operations.

This module implements a thread-safe, async-compatible wrapper around Linux’s io_uring interface. It uses a dedicated submission thread and completion thread to manage the ring, allowing multiple async tasks to share a single ring instance.

§Architecture

┌─────────────┐     ┌──────────────────┐     ┌─────────────────┐
│ Async Tasks │────▶│ Submission Thread │────▶│    io_uring     │
│  (callers)  │     │  (batches SQEs)   │     │ (kernel space)  │
└─────────────┘     └──────────────────┘     └────────┬────────┘
       ▲                                              │
       │            ┌──────────────────┐              │
       └────────────│ Completion Thread │◀────────────┘
                    │  (polls CQEs)     │
                    └──────────────────┘

§Thread Safety

The Uring struct is Clone + Send + Sync. Cloning is cheap (just clones the internal channel sender). All operations are thread-safe.

Modules§

advice
fadvise advice values. These are the standard POSIX fadvise constants.
falloc
fallocate mode flags.

Structs§

ReadResult
Result of a read operation: the buffer and actual bytes read.
RegisteredFile
A file registered with a specific Uring instance for optimized I/O.
Uring
Handle to a shared io_uring instance.
UringCfg
Configuration options for io_uring initialization.
WriteResult
Result of a write operation: the buffer and actual bytes written.

Constants§

URING_LEN_MAX
Maximum length for a single io_uring read/write operation.

Traits§

IoBuf
A buffer that can be used for io_uring write operations.
IoBufMut
A buffer that can be used for io_uring read operations.
UringTarget
Trait for types that can be used as file targets in io_uring operations.