Skip to main content

dope_sys/engine/
mod.rs

1use o3::buffer;
2
3use crate::{
4    io,
5    io::reactor::{complete, ready::delivery},
6    memory::{self, buffer::Recycle},
7};
8
9pub mod admit;
10mod cancel;
11mod install;
12pub mod life;
13pub mod raw;
14pub mod register;
15pub mod ring;
16pub mod shutdown;
17pub use cancel::Cancel;
18pub use install::Install;
19
20/// Exact completed receive ownership and its original projection context.
21pub trait Buffer {
22    type Layout: memory::raw::Layout;
23    type Token: Recycle;
24    type Context: memory::Context<Layout = Self::Layout> + buffer::raw::Fixed<Self::Token>;
25    type Selection: Copy + Eq;
26}
27
28/// Selects the native backend owner for its host's typed contracts.
29pub trait Source<C> {
30    type Map: complete::Map;
31    type Backend: io::Close<State = Self::Closing> + shutdown::Shutdown;
32    type Closing: io::Retry;
33}
34
35/// Native completion queue and the pending buffer owner returned by that queue.
36pub trait Complete {
37    type Map: complete::Map;
38    type Pending: Recycle;
39
40    /// Consumes at most one native completion: `None` is empty, `Some(None)` is
41    /// one internal step, and `Some(Some(entry))` transfers one host-visible entry.
42    fn next(&mut self) -> Option<Option<<Self::Map as complete::Map>::Entry<Self::Pending>>>;
43}
44
45/// Selects one native turn that retains the host and its scheduling quota.
46pub trait Dispatch<'a, C, H>: Source<C>
47where
48    C: delivery::Context<H, Backend = Self::Backend>,
49    H: 'a,
50{
51    type Turn<Q: delivery::Quota<H>>: raw::Dispatch<'a, C, H, Q>;
52}
53
54/// Selects retained construction and fixed-file removal owners for one host.
55pub trait Storage<C, P: Copy, R: Copy>: Removal {
56    type Cleanup: memory::Cleanup<P>;
57    type Release: memory::Cleanup<(R, Self::Slot)>;
58}
59
60/// Selects the native fixed-file target retained by a failed removal.
61pub trait Removal {
62    type Slot: Copy + Eq;
63}