Skip to main content

CoreRingManager

Struct CoreRingManager 

Source
pub struct CoreRingManager { /* private fields */ }
Expand description

Per-core io_uring manager.

Manages a single core’s io_uring instance, buffer pool, and pending operations. Designed for integration with the thread-per-core architecture.

Implementations§

Source§

impl CoreRingManager

Source

pub fn new(core_id: usize, config: &IoUringConfig) -> Result<Self, IoUringError>

Create a new per-core ring manager.

§Arguments
  • core_id - The core ID this manager is for
  • config - io_uring configuration
§Errors

Returns an error if ring creation fails.

Source

pub const fn core_id(&self) -> usize

Get the core ID.

Source

pub const fn is_closed(&self) -> bool

Check if the ring is closed.

Source

pub const fn mode(&self) -> RingMode

Get the main ring mode.

Source

pub const fn uses_sqpoll(&self) -> bool

Check if SQPOLL is enabled.

Source

pub fn has_iopoll_ring(&self) -> bool

Check if IOPOLL is enabled.

Source

pub fn acquire_buffer(&mut self) -> Result<(u16, &mut [u8]), IoUringError>

Acquire a buffer from the main pool.

§Errors

Returns an error if no buffers are available.

Source

pub fn release_buffer(&mut self, buf_index: u16)

Release a buffer back to the main pool.

Source

pub fn submit_read( &mut self, fd: RawFd, buf_index: u16, offset: u64, len: u32, ) -> Result<u64, IoUringError>

Submit a read operation using a registered buffer.

§Errors

Returns an error if submission fails.

Source

pub fn submit_write( &mut self, fd: RawFd, buf_index: u16, offset: u64, len: u32, ) -> Result<u64, IoUringError>

Submit a write operation using a registered buffer.

§Errors

Returns an error if submission fails.

Source

pub fn submit_sync( &mut self, fd: RawFd, datasync: bool, ) -> Result<u64, IoUringError>

Submit an fsync/fdatasync operation.

§Arguments
  • fd - File descriptor to sync
  • datasync - If true, use fdatasync (don’t sync metadata)
§Errors

Returns an error if submission fails.

Source

pub fn submit_close(&mut self, fd: RawFd) -> Result<u64, IoUringError>

Submit a close operation.

§Errors

Returns an error if submission fails.

Source

pub fn submit(&mut self) -> Result<usize, IoUringError>

Submit pending operations to the kernel.

In SQPOLL mode, this is often a no-op since the kernel polls automatically.

§Errors

Returns an error if submission fails.

Source

pub fn submit_and_wait(&mut self, want: usize) -> Result<usize, IoUringError>

Submit and wait for at least one completion.

§Errors

Returns an error if submission or wait fails.

Source

pub fn poll_completions(&mut self) -> Vec<Completion>

Poll for completions without blocking.

Returns all available completions from both rings. Allocates a Vec per call — prefer Self::poll_completions_into on hot paths.

Source

pub fn poll_completions_into(&mut self, out: &mut Vec<Completion>)

Poll for completions into a caller-provided buffer. Zero-alloc.

Appends completions to out. The caller should clear out between iterations to reuse capacity. Uses an internal scratch buffer for CQE data collection (pre-allocated at ring creation).

Source

pub fn wait_for(&mut self, user_data: u64) -> Result<Completion, IoUringError>

Wait for a specific operation to complete.

§Errors

Returns an error if the operation is not found or wait fails.

Source

pub fn pending_count(&self) -> usize

Get the number of pending operations.

Source

pub fn buffer_pool_stats(&self) -> Option<BufferPoolStats>

Get buffer pool statistics.

Source

pub const fn metrics(&self) -> &RingMetrics

Get ring metrics.

Source

pub fn close(&mut self)

Close the ring manager.

Drains all pending operations before closing to prevent in-flight operations from accessing freed memory.

Trait Implementations§

Source§

impl Debug for CoreRingManager

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for CoreRingManager

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> LayoutRaw for T

§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
§

impl<T> Pointee for T

§

type Metadata = ()

The metadata type for pointers and references to this type.
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Scope for T

§

fn with<F, R>(self, f: F) -> R
where Self: Sized, F: FnOnce(Self) -> R,

Scoped with ownership.
§

fn with_ref<F, R>(&self, f: F) -> R
where F: FnOnce(&Self) -> R,

Scoped with reference.
§

fn with_mut<F, R>(&mut self, f: F) -> R
where F: FnOnce(&mut Self) -> R,

Scoped with mutable reference.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

§

impl<T> Value for T
where T: Send + Sync + 'static,