Skip to main content

IoUringBuilder

Struct IoUringBuilder 

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

Construit un IoUring : applique setup flags et restrictions (S3) avant l’activation, puis io_uring_setup(2).

Implementations§

Source§

impl IoUringBuilder

Source

pub fn new(entries: NonZeroU32) -> Self

Démarre un builder pour entries SQE (arrondi par le kernel à la puissance de 2 supérieure).

Source

pub fn with_completion_queue_entries(self, entries: NonZeroU32) -> Self

Fixe explicitement la profondeur de la CQ (IORING_SETUP_CQSIZE).

Source

pub fn max_inflight(self, n: NonZeroU32) -> Self

Capacité du slab d’opérations en vol (S1). Défaut : cq_entries.

Source

pub fn with_flags(self, flags: SetupFlags) -> Self

Active des flags de setup (cf. SetupFlags).

Source

pub fn with_sqpoll_idle(self, idle: Duration) -> Self

Durée d’inactivité avant que le thread SQPOLL ne s’endorme (SETUP_SQPOLL, Temps 3e).

Source

pub fn with_sqpoll_cpu(self, cpu: u32) -> Self

Épingle le thread SQPOLL sur un CPU (SETUP_SQ_AFF).

Source

pub fn attach_work_queue(self, other: &IoUring) -> Self

Partage le pool io-wq d’un ring existant (SETUP_ATTACH_WQ).

Source

pub fn restrict(self, restrictions: &[Restriction]) -> Self

Crée le ring désactivé (R_DISABLED) et applique des restrictions (S3, Temps 3f). Doit être suivi de IoUring::enable.

Source

pub fn build(self) -> Result<IoUring, Errno>

Finalise : traduit la config en io_uring_params, appelle io_uring_setup(2), mmappe les anneaux (§3.1), alloue le slab (§4) et lit les features. Si restrict a été utilisé, le ring est créé désactivé et doit être activé via IoUring::enable.

§Errors
  • [Errno::EINVAL] : paramètres ou combinaison de flags invalides (remontés tels quels, sans masquage).
  • [Errno::ENOMEM] : mémoire insuffisante pour les anneaux/le slab.
  • [Errno::EPERM] : SQPOLL/affinité sans privilège selon la config.
  • [Errno::EFAULT] : pointeur de paramètres invalide.
  • [Errno::ENOSYS] : io_uring indisponible (kernel ancien, sandbox, container durci) — pas de fallback caché (cf. ADR-022 D10).

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.