pub struct RingConfig {
pub queue_depth: u32,
pub fallback_threads: usize,
pub completion_batch: usize,
pub backend: BackendPreference,
pub default_timeout: Option<Duration>,
pub sq_poll_idle_ms: Option<u32>,
pub registered_buffers: Option<RegisteredBufferConfig>,
}Expand description
Configuration for a crate::Ring.
Fields§
§queue_depth: u32Maximum in-flight operations.
fallback_threads: usizeWorker threads for the fallback backend.
completion_batch: usizeCompletion batch size for drain strategies.
backend: BackendPreferenceBackend selection policy.
default_timeout: Option<Duration>Optional default timeout for blocking waits.
sq_poll_idle_ms: Option<u32>Enable IORING_SETUP_SQPOLL - the kernel polls the submission queue
from a dedicated kernel thread, eliminating the submit syscall entirely.
The value is the idle timeout in milliseconds: the kernel thread spins
for this long after the last submission before sleeping. A typical value
is 2000 (2 seconds).
Requires Linux 5.11+ (unprivileged SQPOLL was added in 5.19).
registered_buffers: Option<RegisteredBufferConfig>Pre-register a pool of kernel-pinned buffers for zero-copy I/O.
When set, the native Linux io_uring backend uses this count and size
with IORING_REGISTER_BUFFERS.
When unset, that backend still registers a default pool (32 buffers of
4096 bytes each) so fixed-buffer machinery is always available unless
registration fails during setup.
Implementations§
Source§impl RingConfig
impl RingConfig
Sourcepub fn with_queue_depth(self, queue_depth: u32) -> Self
pub fn with_queue_depth(self, queue_depth: u32) -> Self
Returns a copy with the provided queue depth.
Sourcepub fn with_backend(self, backend: BackendPreference) -> Self
pub fn with_backend(self, backend: BackendPreference) -> Self
Returns a copy with the provided backend policy.
Sourcepub fn with_fallback_threads(self, fallback_threads: usize) -> Self
pub fn with_fallback_threads(self, fallback_threads: usize) -> Self
Returns a copy with the provided fallback thread count.
Sourcepub fn with_completion_batch(self, completion_batch: usize) -> Self
pub fn with_completion_batch(self, completion_batch: usize) -> Self
Returns a copy with the provided completion batch size.
Sourcepub fn with_default_timeout(self, default_timeout: Option<Duration>) -> Self
pub fn with_default_timeout(self, default_timeout: Option<Duration>) -> Self
Returns a copy with the provided default timeout.
Sourcepub fn with_sq_poll(self, idle_ms: u32) -> Self
pub fn with_sq_poll(self, idle_ms: u32) -> Self
Enables IORING_SETUP_SQPOLL with the given idle timeout in milliseconds.
When active, the kernel polls the submission queue from a dedicated
thread, eliminating the io_uring_enter syscall for submissions.
The kernel thread sleeps after idle_ms milliseconds of inactivity.
Sourcepub fn with_registered_buffers(self, count: u32, size: u32) -> Self
pub fn with_registered_buffers(self, count: u32, size: u32) -> Self
Enables pre-registered kernel-pinned buffers.
The ring allocates count buffers of size bytes and registers them
with the kernel at creation time. I/O operations using these buffers
bypass per-operation page pinning overhead.
Trait Implementations§
Source§impl Clone for RingConfig
impl Clone for RingConfig
Source§fn clone(&self) -> RingConfig
fn clone(&self) -> RingConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more