vane_core/lib.rs
1//! # vane-core
2//!
3//! The deterministic transport engine: pinned thread-per-core workers over
4//! `io_uring` (with a mio fallback), fixed buffer pools, a generational
5//! session slab, lock-free SPSC command paths, and kernel splice passthrough.
6//!
7//! Layering:
8//!
9//! ```text
10//! ┌────────────────────────────────────────────┐
11//! │ vane (bin): HTTP handler, routing, filters │
12//! ├────────────────────────────────────────────┤
13//! │ vane-core: Handler trait + Worker runtime │
14//! │ engine::uring engine::mio_engine │
15//! │ buffer pool · session slab · SPSC · splice│
16//! └────────────────────────────────────────────┘
17//! ```
18//!
19//! The engine never allocates on the hot path: sessions live in a
20//! pre-reserved slab, IO buffers come from a fixed pool (registered with the
21//! kernel on io_uring), and cross-thread signaling is lock-free.
22
23#![cfg_attr(test, allow(clippy::unwrap_used, clippy::expect_used))]
24
25/// Forensic trace print. Compiles to NOTHING unless the `vane_dbg`
26/// feature is enabled — every call is a stderr write(2) syscall, and
27/// on the request hot path (read completions, read-arm skips, dials)
28/// that cost dominated the benchmark profile until it was gated.
29#[cfg(feature = "vane_dbg")]
30#[macro_export]
31macro_rules! dbg_trace {
32 ($($arg:tt)*) => { eprintln!($($arg)*) };
33}
34
35/// Forensic trace print (no-op build).
36#[cfg(not(feature = "vane_dbg"))]
37#[macro_export]
38macro_rules! dbg_trace {
39 ($($arg:tt)*) => {};
40}
41
42pub mod buffer;
43pub mod engine;
44pub mod h2;
45pub mod handler;
46pub mod net;
47pub mod slab;
48pub mod splice;
49pub mod spsc;
50pub mod token;
51pub mod worker;
52
53pub use buffer::{BufferPool, DEFAULT_BUF_SIZE, DEFAULT_POOL_SIZE};
54pub use engine::{Cqe, Engine, Poll};
55pub use handler::{Handler, HandlerFactory, Mode, SessionIo};
56pub use net::{set_keepalive, set_nodelay, tcp_listener};
57pub use slab::{SessionSlab, SlabError};
58pub use spsc::{SpscReceiver, SpscRing, SpscSender};
59pub use token::{Op, Token};
60pub use worker::{WorkerCmd, WorkerConfig, WorkerCtx, WorkerHandle, spawn as spawn_worker};
61
62#[cfg(test)]
63mod tests {
64 #[test]
65 fn workspace_compiles() {
66 // Marker test: the crate links end-to-end.
67 }
68}