pub struct ChainBuilder<DF: RecFamily, CurF: RecFamily, D, P> { /* private fields */ }Expand description
Fluent builder for one pipeline’s operator chain. DF is the
deserializer’s record family; CurF the family at the current end of
the chain (changed by map_rec and flat_map, and by map for owned
payloads).
Implementations§
Source§impl<DF: RecFamily, CurF: RecFamily, D, P> ChainBuilder<DF, CurF, D, P>
impl<DF: RecFamily, CurF: RecFamily, D, P> ChainBuilder<DF, CurF, D, P>
Sourcepub fn with_metrics(
self,
pipeline: impl Into<String>,
component: impl Into<String>,
) -> Self
pub fn with_metrics( self, pipeline: impl Into<String>, component: impl Into<String>, ) -> Self
Enable framework metrics for every stage of this chain. Must be called before any stage is added so all stages get handles.
§Panics
Panics if stages were already added.
Sourcepub fn deser_error_policy(self, policy: ErrorPolicy) -> Self
pub fn deser_error_policy(self, policy: ErrorPolicy) -> Self
Error policy for the deserializer stage (default: Skip).
Sourcepub fn map_rec<NF, G>(self, f: G) -> ChainBuilder<DF, NF, D, MapPart<P, G>>
pub fn map_rec<NF, G>(self, f: G) -> ChainBuilder<DF, NF, D, MapPart<P, G>>
Transform each record into family NF. For borrowing families pass
a fn item (see the module docs); for owned payloads
ChainBuilder::map is more ergonomic.
Sourcepub fn try_map_rec<NF, G, E>(
self,
f: G,
policy: ErrorPolicy,
) -> ChainBuilder<DF, NF, D, TryMapPart<P, G>>
pub fn try_map_rec<NF, G, E>( self, f: G, policy: ErrorPolicy, ) -> ChainBuilder<DF, NF, D, TryMapPart<P, G>>
Fallibly transform each record into family NF with a per-stage
ErrorPolicy. For borrowing families pass a fn item.
Sourcepub fn filter<Pr>(self, p: Pr) -> ChainBuilder<DF, CurF, D, FilterPart<P, Pr>>
pub fn filter<Pr>(self, p: Pr) -> ChainBuilder<DF, CurF, D, FilterPart<P, Pr>>
Keep only records whose payload satisfies the predicate.
Sourcepub fn inspect<G>(self, f: G) -> ChainBuilder<DF, CurF, D, InspectPart<P, G>>
pub fn inspect<G>(self, f: G) -> ChainBuilder<DF, CurF, D, InspectPart<P, G>>
Observe each record’s payload without transforming it.
Sourcepub fn flat_map<OutF, G>(
self,
g: G,
) -> ChainBuilder<DF, OutF, D, FlatMapPart<OutF, P, G>>
pub fn flat_map<OutF, G>( self, g: G, ) -> ChainBuilder<DF, OutF, D, FlatMapPart<OutF, P, G>>
Expand each record into 0..N records of family OutF through a
stack-borrowed Emitter.
Sourcepub fn sink<E, R>(
self,
encoder: E,
router: R,
cfg: ChunkConfig,
queues: ShardQueues,
budget: Arc<InflightBudget>,
) -> SinkedChain<DF, CurF, D, P, E, R>
pub fn sink<E, R>( self, encoder: E, router: R, cfg: ChunkConfig, queues: ShardQueues, budget: Arc<InflightBudget>, ) -> SinkedChain<DF, CurF, D, P, E, R>
Terminate the chain into a sink: records are routed by router,
encoded by encoder on the pipeline thread, and handed to the sink
workers through queues.
Source§impl<DF: RecFamily, T: Send + 'static, D, P> ChainBuilder<DF, Owned<T>, D, P>
Closure-friendly transforms for chains whose current records are owned.
impl<DF: RecFamily, T: Send + 'static, D, P> ChainBuilder<DF, Owned<T>, D, P>
Closure-friendly transforms for chains whose current records are owned.
Sourcepub fn map<U, G>(self, f: G) -> ChainBuilder<DF, Owned<U>, D, MapPart<P, G>>
pub fn map<U, G>(self, f: G) -> ChainBuilder<DF, Owned<U>, D, MapPart<P, G>>
Transform each record’s payload. Bare closures infer; the output
type may differ (the chain’s family becomes Owned<U>).
Sourcepub fn try_map<U, G, E>(
self,
f: G,
policy: ErrorPolicy,
) -> ChainBuilder<DF, Owned<U>, D, TryMapPart<P, G>>
pub fn try_map<U, G, E>( self, f: G, policy: ErrorPolicy, ) -> ChainBuilder<DF, Owned<U>, D, TryMapPart<P, G>>
Fallibly transform each record’s payload with a per-stage
ErrorPolicy.
Trait Implementations§
Source§impl<DF: Clone + RecFamily, CurF: Clone + RecFamily, D: Clone, P: Clone> Clone for ChainBuilder<DF, CurF, D, P>
impl<DF: Clone + RecFamily, CurF: Clone + RecFamily, D: Clone, P: Clone> Clone for ChainBuilder<DF, CurF, D, P>
Source§fn clone(&self) -> ChainBuilder<DF, CurF, D, P>
fn clone(&self) -> ChainBuilder<DF, CurF, D, P>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more