1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
//! ringline — io_uring-native async I/O runtime for Linux.
//!
//! ringline is a thread-per-core I/O framework built directly on io_uring.
//! It provides an async/await API ([`AsyncEventHandler`]) on a single-threaded
//! executor with no work-stealing.
//!
//! # Quick Start
//!
//! ```rust,no_run
//! use ringline::{AsyncEventHandler, Config, ConnCtx, ParseResult, RinglineBuilder};
//!
//! struct Echo;
//!
//! impl AsyncEventHandler for Echo {
//! fn on_accept(&self, conn: ConnCtx) -> impl std::future::Future<Output = ()> + 'static {
//! async move {
//! loop {
//! let n = conn.with_data(|data| {
//! conn.send_nowait(data).ok();
//! ParseResult::Consumed(data.len())
//! }).await;
//! if n == 0 { break; }
//! }
//! }
//! }
//! fn create_for_worker(_id: usize) -> Self { Echo }
//! }
//!
//! fn main() -> Result<(), ringline::Error> {
//! let config = Config::default();
//! let (_shutdown, handles) = RinglineBuilder::new(config)
//! .bind("127.0.0.1:7878".parse().unwrap())
//! .launch::<Echo>()?;
//! for h in handles { h.join().unwrap()?; }
//! Ok(())
//! }
//! ```
//!
//! # Platform
//!
//! Linux 6.0+ only. Requires io_uring with multishot recv, ring-provided
//! buffers, SendMsgZc, and fixed file table support.
// ── Internal modules ────────────────────────────────────────────────────
pub
pub
pub
pub
pub
pub
pub
pub
pub
pub
pub
pub
pub
pub
// ── Public modules ──────────────────────────────────────────────────────
// ── Re-exports: Handler types ─────────────────────────────────────────
/// Opaque connection handle.
pub use ConnToken;
/// I/O context passed to [`AsyncEventHandler::on_tick`] and [`AsyncEventHandler::on_notify`].
pub use DriverCtx;
/// Pre-classified part for [`AsyncSendBuilder::submit_batch`].
pub use SendPart;
/// Opaque handle for a UDP socket.
pub use UdpToken;
// ── Re-exports: Async API ───────────────────────────────────────────────
/// Error returned by [`try_sleep()`] and [`try_timeout()`] when the timer pool is full.
pub use TimerExhausted;
/// Errors returned by UDP send operations.
pub use UdpSendError;
/// Trait for async event handlers (one task per connection).
pub use AsyncEventHandler;
/// Async scatter-gather send builder.
pub use AsyncSendBuilder;
/// Async connection context with send/recv futures.
pub use ConnCtx;
/// Future that completes when a connect finishes.
pub use ConnectFuture;
/// A monotonic clock deadline for absolute timers.
pub use Deadline;
/// Future that awaits a disk I/O completion (NVMe or Direct I/O).
pub use DiskIoFuture;
/// Error returned when a [`timeout()`] expires.
pub use Elapsed;
/// Result of a parse closure: consumed bytes or need more data.
pub use ParseResult;
/// Future that resolves when recv data is available (sink, accumulator, or close).
pub use RecvReadyFuture;
/// Future that completes when a send finishes.
pub use SendFuture;
/// Future returned by [`sleep()`].
pub use SleepFuture;
/// Future returned by [`timeout()`].
pub use TimeoutFuture;
/// Async context for a UDP socket.
pub use UdpCtx;
/// Future returned by [`UdpCtx::recv_from()`].
pub use UdpRecvFuture;
/// Future that provides received data as zero-copy `Bytes`.
pub use WithBytesFuture;
/// Future that provides received data.
pub use WithDataFuture;
/// Initiate an outbound TCP connection from any async task.
pub use connect;
/// Initiate an outbound TLS connection from any async task.
pub use connect_tls;
/// Initiate an outbound TLS connection with a timeout from any async task.
pub use connect_tls_with_timeout;
/// Initiate an outbound TCP connection with a timeout from any async task.
pub use connect_with_timeout;
/// Submit a Direct I/O read and return a future for the result.
pub use direct_io_read;
/// Submit a Direct I/O write and return a future for the result.
pub use direct_io_write;
/// Submit an NVMe read and return a future for the result.
pub use nvme_read;
/// Submit an NVMe write and return a future for the result.
pub use nvme_write;
/// Open a Direct I/O file from any async task.
pub use open_direct_io_file;
/// Open an NVMe device from any async task.
pub use open_nvme_device;
/// Request graceful shutdown from any async task.
pub use request_shutdown;
/// Create a future that completes after a duration.
pub use sleep;
/// Create a future that completes at an absolute deadline.
pub use sleep_until;
/// Spawn a standalone async task on the current worker.
pub use spawn;
/// Wrap a future with a deadline.
pub use timeout;
/// Wrap a future with an absolute deadline.
pub use timeout_at;
/// Fallible sleep that returns an error if the timer pool is exhausted.
pub use try_sleep;
/// Fallible sleep_until that returns an error if the timer pool is exhausted.
pub use try_sleep_until;
/// Fallible timeout that returns an error if the timer pool is exhausted.
pub use try_timeout;
/// Fallible timeout_at that returns an error if the timer pool is exhausted.
pub use try_timeout_at;
/// Future returned by [`join()`].
pub use Join;
/// Future returned by [`join3()`].
pub use Join3;
/// Poll two futures concurrently, returning both outputs when complete.
pub use join;
/// Poll three futures concurrently, returning all outputs when complete.
pub use join3;
/// Result of [`select()`] — which branch completed.
pub use Either;
/// Result of [`select3()`] — which branch completed.
pub use Either3;
/// Future returned by [`select()`].
pub use Select;
/// Future returned by [`select3()`].
pub use Select3;
/// Poll two futures concurrently, returning whichever completes first.
pub use select;
/// Poll three futures concurrently, returning whichever completes first.
pub use select3;
/// Opaque handle for a standalone spawned task.
pub use TaskId;
// ── Re-exports: Shared types ────────────────────────────────────────────
/// Memory region for io_uring fixed buffer registration.
pub use MemoryRegion;
/// Region identifier for [`SendGuard`] implementations.
pub use RegionId;
/// Maximum zero-copy guards per scatter-gather send.
pub use MAX_GUARDS;
/// Maximum iovecs per scatter-gather send.
pub use MAX_IOVECS;
/// Runtime configuration.
pub use Config;
/// Builder for [`Config`] with discoverable methods and `build()` validation.
pub use ConfigBuilder;
/// Recv buffer ring configuration.
pub use RecvBufferConfig;
/// Worker thread configuration.
pub use WorkerConfig;
/// Direct I/O completion result.
pub use DirectIoCompletion;
/// Direct I/O configuration.
pub use DirectIoConfig;
/// Direct I/O file handle.
pub use DirectIoFile;
/// Direct I/O operation type.
pub use DirectIoOp;
/// Runtime errors.
pub use Error;
/// Zero-copy send guard trait.
pub use ;
/// NVMe passthrough completion result.
pub use NvmeCompletion;
/// NVMe passthrough configuration.
pub use NvmeConfig;
/// NVMe passthrough device handle.
pub use NvmeDevice;
/// Builder for launching ringline workers.
pub use RinglineBuilder;
/// Handle for triggering graceful shutdown.
pub use ShutdownHandle;
// ── Re-exports: TLS (feature-gated) ────────────────────────────────────
/// Client-side TLS configuration.
pub use TlsClientConfig;
/// Server-side TLS configuration.
pub use TlsConfig;
/// TLS session info (protocol version, cipher suite, etc.).
pub use TlsInfo;