Struct I2o2Builder

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

A set of configuration options for customising the I2o2Scheduler scheduler.

§Example

use std::time::Duration;

let (scheduler, handle) = i2o2::I2o2Builder::default()
    .with_io_polling(true)
    .try_create::<()>()?;

// ... do work

Implementations§

Source§

impl I2o2Builder

Source

pub const fn with_queue_size(self, size: u32) -> Self

Set the queue size of the message queue between clients and the scheduler.

This value will be rounded to the nearest power of two.

By default, this is 128.

Source

pub const fn with_ring_depth(self, size: u32) -> Self

Set the ring depth.

This is the SQ size of the ring itself.

This value must be a power of two.

By default, this is 128.

Source

pub const fn with_sqe_size128(self, enabled: bool) -> Self

Set the size of the SQ entry to be 128 bytes instead of 64.

This is only required for the opcode::UringCmd80 op, for NVME pass through.

By default, this is false.

Source

pub const fn with_num_registered_buffers(self, size: u32) -> Self

Set the maximum number of registered buffers that might be registered with the ring.

This is value cannot be updated once the ring in created and is used to allocate the necessary structures for the ring.

WARNING: You must have a kernel version 5.19+ in order for this API to not error on creation.

By default, this is 0.

Source

pub const fn with_num_registered_files(self, size: u32) -> Self

Set the maximum number of registered files that might be registered with the ring.

This is value cannot be updated once the ring in created and is used to allocate the necessary structures for the ring.

By default, this is 0.

Source

pub const fn with_io_polling(self, enable: bool) -> Self

Enable/disable IO polling.

Sets IORING_SETUP_IOPOLL

https://www.man7.org/linux/man-pages/man2/io_uring_setup.2.html

Perform busy-waiting for an I/O completion, as opposed to getting notifications via an asynchronous IRQ (Interrupt Request).

WARNING: Enabling this option requires all file IO events to be O_DIRECT

By default, this is disabled.

Source

pub const fn with_coop_task_run(self, enable: bool) -> Self

Enables/disables the coop task run io_uring flag.

Sets IORING_SETUP_COOP_TASKRUN

https://www.man7.org/linux/man-pages/man2/io_uring_setup.2.html

By default, io_uring will interrupt a task running in userspace when a completion event comes in. This is to ensure that completions run in a timely manner. For a lot of use cases, this is overkill and can cause reduced performance from both the inter-processor interrupt used to do this, the kernel/user transition, the needless interruption of the tasks userspace activities, and reduced batching if completions come in at a rapid rate. Most applications don’t need the forceful interruption, as the events are processed at any kernel/user transition. The exception are setups where the application uses multiple threads operating on the same ring, where the application waiting on completions isn’t the one that submitted them. For most other use cases, setting this flag will improve performance.

WARNING: You must have a kernel version 5.19+ in order for this API to not error on creation.

By default, this is disabled.

Source

pub fn try_create<G>(self) -> Result<(I2o2Scheduler<G>, I2o2Handle<G>)>

Attempt to create the scheduler using the current configuration.

Source

pub fn try_spawn<G>(self) -> Result<(JoinHandle<Result<()>>, I2o2Handle<G>)>
where G: Send + 'static,

Attempt to create the scheduler and run it in a background thread using the current configuration.

Source

pub fn try_spawn_and_pin<G>( self, cpu_set: CpuSet, ) -> Result<(JoinHandle<Result<()>>, I2o2Handle<G>)>
where G: Send + 'static,

Attempt to create the scheduler and run it in a background thread using the current configuration and pin the thread to a specific CPU.

Trait Implementations§

Source§

impl Clone for I2o2Builder

Source§

fn clone(&self) -> I2o2Builder

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for I2o2Builder

Source§

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

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

impl Default for I2o2Builder

Source§

fn default() -> Self

Returns the “default value” for a 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
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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