Skip to main content

SinkParts

Struct SinkParts 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§writer: W

The connector’s writer, shared by every shard worker.

§shard_endpoints: Vec<Vec<<W as ShardWriter>::Endpoint>>

Per-shard replica endpoints, [shard][replica].

§pool: SinkPoolConfig

Pool tuning (batching, inflight, retry, breaker).

§component_type: String

The 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,

Source

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.

Source

pub fn with_component_type( self, component_type: impl Into<String>, ) -> SinkParts<W>

Set the component_type metric label.

Source

pub fn with_replica_labels(self, labels: Vec<Vec<String>>) -> SinkParts<W>

Set per-replica display labels (same [shard][replica] shape as the endpoints).

Source

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.

Source

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,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<W> SinkBundle for SinkParts<W>
where W: ShardWriter,

Source§

type Writer = W

The connector’s ShardWriter implementation.
Source§

fn into_parts(self) -> SinkParts<W>

Decompose into the parts the builder wires up. Consuming: the endpoints move into the sink pool.

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>
where W: Unpin, <W as ShardWriter>::Endpoint: Unpin,

§

impl<W> UnsafeUnpin for SinkParts<W>
where W: UnsafeUnpin,

§

impl<W> !UnwindSafe for SinkParts<W>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<U> As for U

§

fn as_<T>(self) -> T
where T: CastFrom<U>,

Casts 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
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Is for T
where T: ?Sized,

§

type EqTo = T

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,