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
impl IoUringBuilder
Sourcepub fn new(entries: NonZeroU32) -> Self
pub fn new(entries: NonZeroU32) -> Self
Démarre un builder pour entries SQE (arrondi par le kernel à la
puissance de 2 supérieure).
Sourcepub fn with_completion_queue_entries(self, entries: NonZeroU32) -> Self
pub fn with_completion_queue_entries(self, entries: NonZeroU32) -> Self
Fixe explicitement la profondeur de la CQ (IORING_SETUP_CQSIZE).
Sourcepub fn max_inflight(self, n: NonZeroU32) -> Self
pub fn max_inflight(self, n: NonZeroU32) -> Self
Capacité du slab d’opérations en vol (S1). Défaut : cq_entries.
Sourcepub fn with_flags(self, flags: SetupFlags) -> Self
pub fn with_flags(self, flags: SetupFlags) -> Self
Active des flags de setup (cf. SetupFlags).
Sourcepub fn with_sqpoll_idle(self, idle: Duration) -> Self
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).
Sourcepub fn with_sqpoll_cpu(self, cpu: u32) -> Self
pub fn with_sqpoll_cpu(self, cpu: u32) -> Self
Épingle le thread SQPOLL sur un CPU (SETUP_SQ_AFF).
Sourcepub fn attach_work_queue(self, other: &IoUring) -> Self
pub fn attach_work_queue(self, other: &IoUring) -> Self
Partage le pool io-wq d’un ring existant (SETUP_ATTACH_WQ).
Sourcepub fn restrict(self, restrictions: &[Restriction]) -> Self
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.
Sourcepub fn build(self) -> Result<IoUring, Errno>
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).