Expand description
Dedicated writer task for high-throughput frame sending.
This module replaces the Arc<Mutex<BoxedWriter>> pattern with a dedicated
writer task that receives frames via an mpsc channel. This eliminates lock
contention and enables batching multiple frames into single syscalls.
§Architecture
Handler 1 ─┐
Handler 2 ─┼─► mpsc::Sender<OutboundFrame> ─► Writer Task ─► Pipe
Handler N ─┘§Benefits
- No lock contention: Channel-based, not mutex-based
- Batching: Multiple frames can be written in a single syscall via writev
- Backpressure: Built-in pending count tracking with configurable limits
Structs§
- Outbound
Frame - A frame ready to be written to the pipe.
- Writer
Config - Configuration for the writer task.
- Writer
Handle - Handle for sending frames to the writer task.
Constants§
- DEFAULT_
BACKPRESSURE_ TIMEOUT - Default backpressure timeout.
- DEFAULT_
CHANNEL_ CAPACITY - Default channel capacity.
- DEFAULT_
MAX_ PENDING_ FRAMES - Default maximum pending frames before backpressure kicks in.
Functions§
- spawn_
writer_ task - Spawn the writer task and return a handle for sending frames.
- spawn_
writer_ task_ default - Spawn the writer task with default configuration.