pub struct SinkPool<W>where
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> SinkPool<W>where
W: ShardWriter,
impl<W> SinkPool<W>where
W: ShardWriter,
Sourcepub fn spawn(
writer: Arc<W>,
shard_endpoints: Vec<Vec<<W as ShardWriter>::Endpoint>>,
receivers: Vec<Receiver<EncodedChunk>>,
config: SinkPoolConfig,
budget: Arc<InflightBudget>,
metrics: Vec<SinkShardMetrics>,
pipeline_name: &str,
runtime: &Handle,
) -> SinkPool<W>
pub fn spawn( writer: Arc<W>, shard_endpoints: Vec<Vec<<W as ShardWriter>::Endpoint>>, receivers: Vec<Receiver<EncodedChunk>>, config: SinkPoolConfig, budget: Arc<InflightBudget>, metrics: Vec<SinkShardMetrics>, pipeline_name: &str, runtime: &Handle, ) -> SinkPool<W>
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.
Trait Implementations§
Auto Trait Implementations§
impl<W> Freeze for SinkPool<W>
impl<W> RefUnwindSafe for SinkPool<W>
impl<W> Send for SinkPool<W>
impl<W> Sync for SinkPool<W>
impl<W> Unpin for SinkPool<W>
impl<W> UnsafeUnpin for SinkPool<W>
impl<W> UnwindSafe for SinkPool<W>
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read more