pub struct SinkPool<W: ShardWriter> { /* private fields */ }Expand description
Shard workers plus the handles to probe and drain them.
Construction wiring: build the queues with
shard_queues, hand the [ShardQueues]
(senders) to the pipeline threads’ terminal stages, and the receivers to
SinkPool::spawn.
Implementations§
Source§impl<W: ShardWriter> SinkPool<W>
impl<W: ShardWriter> SinkPool<W>
Sourcepub fn spawn(
writer: Arc<W>,
shard_endpoints: Vec<Vec<W::Endpoint>>,
receivers: Vec<Receiver<EncodedChunk>>,
config: SinkPoolConfig,
budget: Arc<InflightBudget>,
metrics: Vec<SinkShardMetrics>,
pipeline_name: &str,
runtime: &Handle,
) -> Self
pub fn spawn( writer: Arc<W>, shard_endpoints: Vec<Vec<W::Endpoint>>, receivers: Vec<Receiver<EncodedChunk>>, config: SinkPoolConfig, budget: Arc<InflightBudget>, metrics: Vec<SinkShardMetrics>, pipeline_name: &str, runtime: &Handle, ) -> Self
Spawn one worker per shard onto runtime.
shard_endpoints[s] are shard s’s replica endpoints;
receivers[s] its chunk queue; metrics[s] its pre-registered
handles. All three must have equal length, with at least one replica
per shard.
§Panics
Panics when the lengths disagree or a shard has no replicas — construction-time configuration errors.
Sourcepub async fn probe_all(&self) -> Result<(), SinkError>
pub async fn probe_all(&self) -> Result<(), SinkError>
Probe every replica of every shard (readiness). Fails on the first unhealthy endpoint.
Sourcepub async fn drain(self, deadline: Duration) -> DrainReport
pub async fn drain(self, deadline: Duration) -> DrainReport
Drain the pool: workers force-seal partial batches, then in-flight
writes get until deadline before being aborted and abandoned.
Contract: the caller must have dropped every [ShardQueues]
(super::ShardQueues) clone first — workers only enter their drain
phase once their queue closes.