pub enum ShardMessage {
Single {
request: ShardRequest,
reply: Sender<ShardResponse>,
},
SingleReusable {
request: ShardRequest,
reply: Sender<ShardResponse>,
},
Batch(Vec<(ShardRequest, Sender<ShardResponse>)>),
}Expand description
A request (or batch of requests) bundled with reply channels.
The Batch variant reduces channel traffic during pipelining: instead
of N individual sends (one per pipelined command), the connection handler
groups commands by target shard and sends one Batch message per shard.
This cuts channel contention from O(pipeline_depth) to O(shard_count).
The SingleReusable variant avoids per-command oneshot::channel()
allocation on the P=1 (no pipeline) path. The connection handler keeps
a long-lived mpsc::channel(1) and reuses it across commands.
Variants§
Single
A single request with its reply channel.
SingleReusable
A single request using a reusable mpsc reply channel.
Avoids the heap allocation of oneshot::channel() on every command.
Used for the P=1 fast path where the connection handler sends one
command at a time and waits for the response before sending the next.
Batch(Vec<(ShardRequest, Sender<ShardResponse>)>)
Multiple requests batched for a single channel send.