#[non_exhaustive]pub struct SinkParts<W>where
W: ShardWriter,{
pub writer: W,
pub shard_endpoints: Vec<Vec<<W as ShardWriter>::Endpoint>>,
pub pool: SinkPoolConfig,
pub component_type: String,
pub replica_labels: Vec<Vec<String>>,
pub probe: Option<Box<dyn Fn() -> Pin<Box<dyn Future<Output = Result<(), SinkError>> + Send>> + Sync + Send>>,
}Expand description
The decomposed sink. Construct with SinkParts::new and refine with
the with_* methods (the struct is #[non_exhaustive]; fields may be
added without breaking implementors).
shard_endpoints is indexed [shard][replica] and must be non-empty
with every shard holding at least one replica — the builder rejects
ragged or empty topologies before anything spawns.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.writer: WThe connector’s writer, shared by every shard worker.
shard_endpoints: Vec<Vec<<W as ShardWriter>::Endpoint>>Per-shard replica endpoints, [shard][replica].
pool: SinkPoolConfigPool tuning (batching, inflight, retry, breaker).
component_type: StringThe component_type metric label (e.g. "clickhouse").
replica_labels: Vec<Vec<String>>Per-replica display labels for shard metrics, same shape as
shard_endpoints. Defaults to "{component_type}-{shard}-{replica}".
probe: Option<Box<dyn Fn() -> Pin<Box<dyn Future<Output = Result<(), SinkError>> + Send>> + Sync + Send>>Optional readiness probe. Probes should use their own client set — sharing the writer’s connections would report the insert path healthy simply because probing keeps it warm.
Implementations§
Source§impl<W> SinkParts<W>where
W: ShardWriter,
impl<W> SinkParts<W>where
W: ShardWriter,
Sourcepub fn new(
writer: W,
shard_endpoints: Vec<Vec<<W as ShardWriter>::Endpoint>>,
pool: SinkPoolConfig,
) -> SinkParts<W>
pub fn new( writer: W, shard_endpoints: Vec<Vec<<W as ShardWriter>::Endpoint>>, pool: SinkPoolConfig, ) -> SinkParts<W>
Minimal parts: component_type defaults to "custom", replica
labels to "{component_type}-{shard}-{replica}", no probe.
Sourcepub fn with_component_type(
self,
component_type: impl Into<String>,
) -> SinkParts<W>
pub fn with_component_type( self, component_type: impl Into<String>, ) -> SinkParts<W>
Set the component_type metric label.
Sourcepub fn with_replica_labels(self, labels: Vec<Vec<String>>) -> SinkParts<W>
pub fn with_replica_labels(self, labels: Vec<Vec<String>>) -> SinkParts<W>
Set per-replica display labels (same [shard][replica] shape as
the endpoints).
Sourcepub fn with_probe(
self,
probe: Box<dyn Fn() -> Pin<Box<dyn Future<Output = Result<(), SinkError>> + Send>> + Sync + Send>,
) -> SinkParts<W>
pub fn with_probe( self, probe: Box<dyn Fn() -> Pin<Box<dyn Future<Output = Result<(), SinkError>> + Send>> + Sync + Send>, ) -> SinkParts<W>
Attach a readiness probe.
Sourcepub fn effective_replica_labels(&self) -> Vec<Vec<String>>
pub fn effective_replica_labels(&self) -> Vec<Vec<String>>
The replica labels to use: the configured ones, or the
"{component_type}-{shard}-{replica}" defaults. Manual assemblies
can feed these to
SinkShardMetrics::new.
Trait Implementations§
Source§impl<W> Debug for SinkParts<W>where
W: ShardWriter,
impl<W> Debug for SinkParts<W>where
W: ShardWriter,
Source§impl<W> SinkBundle for SinkParts<W>where
W: ShardWriter,
impl<W> SinkBundle for SinkParts<W>where
W: ShardWriter,
Source§type Writer = W
type Writer = W
ShardWriter implementation.Source§fn into_parts(self) -> SinkParts<W>
fn into_parts(self) -> SinkParts<W>
Auto Trait Implementations§
impl<W> Freeze for SinkParts<W>where
W: Freeze,
impl<W> !RefUnwindSafe for SinkParts<W>
impl<W> Send for SinkParts<W>
impl<W> Sync for SinkParts<W>
impl<W> Unpin for SinkParts<W>
impl<W> UnsafeUnpin for SinkParts<W>where
W: UnsafeUnpin,
impl<W> !UnwindSafe for SinkParts<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