Expand description
A thread-per-core io_uring worker for the native MoQ stack.
One Worker per pinned thread. It owns a SINGLE_ISSUER | DEFER_TASKRUN | COOP_TASKRUN ring, a userspace timer heap, a local task set, and the UDP
sockets bound through it. The caller owns the thread loop: drive everything
with Worker::block_on, spawn extra !Send tasks through Handle, and
wake the worker from other threads through any std::task::Waker it hands
out (a futex word, no ring or syscall needed while the worker is awake).
UDP is the point: udp::Socket receives through one multishot recvmsg
with a registered provided-buffer ring (one whole buffer per completion,
UDP_GRO coalesced) and sends with an explicit UDP_SEGMENT control
message per sendmsg from a growable pool of staging buffers.
quic stacks a sans-IO QUIC stack on that path: a quic::Endpoint
serves many connections on one socket (demuxed by connection id, dials
included), each a quic::Connection implementing the transport traits,
so moq_net::Client::connect_lite and Server::accept_lite run real
moq-lite sessions on the worker. The socket is the identity: whatever is
built on it runs on the worker that adopted it, and a socket adopted as a
member of a steered reuseport group (udp::Bound) issues connection ids
that steer back to it. Handle::run supplies time and schedules driver
wakeups; callers run the returned drivers with Handle::spawn. The stack
underneath is enabled by the noq feature; a build without it leaves the
module out.
metrics::Metrics is how the worker’s own health leaves its thread:
relaxed counters for the buffer pools, the batching mechanisms, the ring,
and the scheduler, snapshotted from anywhere. Hand one to
Config::metrics to keep a copy where the worker was spawned, or read the
worker’s own through Handle::metrics.
Requires Linux 6.12; Worker::new refuses older kernels with a legible
error instead of degrading. The crate compiles to nothing off Linux.
Re-exports§
pub use url;
Modules§
- metrics
- Per-worker counters: buffer-pool health, batch effectiveness, ring traffic, and scheduling.
- quic
- QUIC connections over the worker’s UDP path, as a MoQ transport.
- udp
- UDP through the worker’s ring: batched receive, GSO send.
Structs§
- Config
- Worker construction knobs.
- Handle
- A worker’s cloneable, thread-local handle.
- Timer
- A single re-armable timer slot in a worker’s heap.
- Worker
- A thread-pinned io_uring executor: the ring, a timer heap, and a local
(
!Send) task set, driven by a caller-owned loop.
Enums§
- Error
- Why a worker or socket could not be set up or has failed.