pub struct Ring<T, E: RingOp<T>> { /* private fields */ }agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Expand description
An io_uring instance.
Implementations§
Source§impl<T, E: RingOp<T>> Ring<T, E>
impl<T, E: RingOp<T>> Ring<T, E>
Sourcepub fn new(ring: IoUring, ctx: T) -> Self
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn new(ring: IoUring, ctx: T) -> Self
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Creates a new ring with the provided io_uring instance and context.
The context T is a user defined value that will be passed to entries E once they
complete. This value can be used to update state or perform additional actions as operations
complete asynchronously.
Sourcepub fn context(&self) -> &T
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn context(&self) -> &T
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Returns a reference to the context value.
Sourcepub fn context_mut(&mut self) -> &mut T
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn context_mut(&mut self) -> &mut T
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Returns a mutable reference to the context value.
Sourcepub unsafe fn register_buffers(&self, iovecs: &[iovec]) -> Result<()>
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub unsafe fn register_buffers(&self, iovecs: &[iovec]) -> Result<()>
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Registers in-memory fixed buffers for I/O with the kernel.
§Safety
Callers must ensure that the iov_base and iov_len values are valid and will be valid until buffers are unregistered or the ring destroyed, otherwise undefined behaviour may occur.
Sourcepub fn register_files(&self, fds: &[RawFd]) -> Result<()>
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn register_files(&self, fds: &[RawFd]) -> Result<()>
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Registers file descriptors as fixed for I/O with the kernel.
Operations may then use types::Fixed(index) for index in fds to refer to the
registered file descriptor.
-1 values can be used as slots for kernel managed fixed file descriptors (created by
open operation).
Sourcepub fn push(&mut self, op: E) -> Result<()>
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn push(&mut self, op: E) -> Result<()>
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Pushes an operation to the submission queue.
Once completed, RingOp::complete will be called with the result.
Note that the operation is not submitted to the kernel until Ring::submit is called. If the submission queue is full, submit will be called internally to make room for the new operation.
See also Ring::submit.
Sourcepub fn submit(&mut self) -> Result<()>
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn submit(&mut self) -> Result<()>
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Submits all pending operations to the kernel.
If the ring can’t accept any more submissions because the completion queue is full, this will process completions and retry until the submissions are accepted.
See also Ring::process_completions.
Sourcepub fn submit_and_wait(
&mut self,
want: usize,
timeout: Option<Duration>,
) -> Result<usize>
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn submit_and_wait( &mut self, want: usize, timeout: Option<Duration>, ) -> Result<usize>
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Submits all pending operations to the kernel and waits for completions.
If no timeout is passed this will block until want completions are available. If a
timeout is passed, this will block until want completions are available or the timeout is
reached.
Returns the number of completions received.
Sourcepub fn process_completions(&mut self) -> Result<()>
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn process_completions(&mut self) -> Result<()>
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Processes completions from the kernel.
This will process all completions currently available in the completion queue and invoke RingOp::complete for each completed operation.
Sourcepub fn drain(&mut self) -> Result<()>
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn drain(&mut self) -> Result<()>
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Drains the ring.
This will submit all pending operations to the kernel and process all completions until the ring is empty.