Skip to main content

dope_sys/io/reactor/submit/
queue.rs

1use o3::{base::num::bounded, depot::capacity};
2
3use crate::io::{
4    reactor::{
5        Full, complete,
6        submit::{self, Ready},
7    },
8    socket::option::tuning,
9};
10
11/// An exclusive view of locally staged native submissions.
12pub trait Queue<'q, T: complete::raw::Token>: Sized {
13    type Owned;
14    type Vacancy: submit::raw::Vacancy<'q, T, Owned = Self::Owned>;
15    type Reserved<const N: usize>: tuning::raw::Chain<T, N>;
16    type Prepared<'e, E: 'e, const N: usize>: Ready;
17
18    fn refresh(&mut self);
19    fn len(&self) -> bounded::U32<0, { u32::MAX }>;
20    fn is_empty(&self) -> bool;
21    fn try_one(self) -> Result<Self::Vacancy, Full>;
22    /// Acquires the current kernel head without publishing local submissions.
23    /// A full queue leaves both cached and shared queue state unchanged.
24    fn try_acquire(self) -> Result<Self::Vacancy, Full>;
25    fn try_reserve<const N: usize>(
26        self,
27        count: capacity::Limit<N>,
28    ) -> Result<Self::Reserved<N>, Full>;
29    fn prepare<'e, const N: usize>(
30        self,
31        entries: &'e [Self::Owned; N],
32    ) -> Result<Self::Prepared<'e, Self::Owned, N>, Full>;
33}