Expand description
IPC Protocol with Multiplexing and Streaming
From mm.md Task 7.1: Pipelined IPC Protocol
§Problem
Current IPC is request-response, blocking client during server work:
Client: Send Request -> Wait -> Receive Response -> Send Next Request
Latency: sum of all request latencies§Solution
Pipelining with request IDs and async responses:
+------------+ +------------+
| Client | | Server |
+------------+ +------------+
| |
|--- Req(id=1) ---->|
|--- Req(id=2) ---->|
|--- Req(id=3) ---->| (no wait)
| |
|<-- Resp(id=2) ----| (out-of-order OK)
|<-- Resp(id=1) ----|
|<-- Resp(id=3) ----|
| |
Protocol: Unix domain socket with length-prefixed messages
Frame: [4-byte length][request_id: u64][msg_type: u8][payload...]§Benefits
- No head-of-line blocking
- Batched network I/O
- Supports streaming responses for large result sets
- Backpressure through flow control
Structs§
- Batch
Request - Batch request builder for efficient pipelining
- Flow
Control - Flow control state
- Frame
- Complete IPC frame
- Frame
Header - IPC frame header
- Frame
Reader - Frame reader for parsing incoming frames
- Frame
Writer - Frame writer for serializing outgoing frames
- IpcServer
- IPC server for handling incoming connections
- Request
Multiplexer - Request multiplexer for pipelining
- Stream
Writer - Stream response writer for sending chunked results
Enums§
- IpcError
- IPC error types
- Message
Type - Message types in the IPC protocol
Traits§
- Request
Handler - Request handler trait for server-side processing