Skip to main content

Pipeline

Struct Pipeline 

Source
pub struct Pipeline { /* private fields */ }
Expand description

Ordered list of transform stages.

An empty pipeline is identity: is_identity is true and apply helpers return immediately without dispatching any stage.

§Identity vs passthrough

Pushing a lone crate::pipeline::Passthrough via push_inplace does not make is_identity return true — the pipeline still has a stage and will dispatch into it. TOML config loading (crate::pipeline::Pipeline::from_config / crate::pipeline::parse_transforms_toml) collapses passthrough-only configs to an empty pipeline so the CLI identity path stays zero-dispatch.

§Apply path

Shared apply loop: transform → ordered write → watermark. crate::pipeline::ApplyContext / crate::pipeline::SourceDriver gate on crate::pipeline::BatchTransformer::is_identity (implemented for Pipeline via is_identity) so the transform tokio::task::JoinSet can take an async no-op path (zero stage dispatch). That is not a write-path bypass: identity batches still go through the ordered sink step (including homogeneous Update coalesce to write_universal_*). Only an empty stage list is identity — not “stages happen to be no-ops.”

§Schema-aware / FK transforms

Construct an InPlaceTransform with schema (e.g. FK → Thing links) and push_inplace it. Relation edges use the same pipeline via relation transform methods; full join-table→relation conversion may still live in a source crate.

§External + relations

External stages exchange both row changes and relation changes over NDJSON (ExternalTransform::exchange_relation_changes / ExternalTransform::exchange_relations). There is no silent relation pass-through. Mixed change+relation batches may not filter/fan-out (length of each kind must be preserved); use homogeneous batches for length changes.

When a single External stage sees a mixed change+relation batch, the two wire exchanges use distinct batch_ids: changes keep the apply batch_id, relations use crate::pipeline::relation_wire_batch_id (high bit set) so workers and outstanding-id tracking never confuse the two sequential exchanges.

Implementations§

Source§

impl Pipeline

Source

pub fn from_config(cfg: &TransformsConfig) -> Result<Self>

Build a pipeline from validated config.

Empty config → identity (is_identity true). Command stages spawn child workers (persistent) or store argv (transient). Both modes resolve command[0] at config time so bad argv fails fast (transient would otherwise only fail on the first batch).

Source§

impl Pipeline

Source

pub fn new() -> Self

Create an empty (identity) pipeline.

Source

pub fn is_identity(&self) -> bool

Whether this pipeline has no stages (identity / no stage dispatch).

Only an empty stage list is identity. A pipeline that contains only crate::pipeline::Passthrough still returns false here — see type-level docs.

Source

pub fn len(&self) -> usize

Number of stages (0 = identity).

Source

pub fn is_empty(&self) -> bool

Whether there are no stages.

Source

pub fn stages(&self) -> &[Stage]

Borrow the stage list.

Source

pub fn push_inplace<T>(&mut self, transform: T)
where T: InPlaceTransform + 'static,

Append an in-place transform stage (library / embedder API).

Note: appending crate::pipeline::Passthrough alone does not yield an identity pipeline (is_identity stays false).

Source

pub fn push_inplace_arc(&mut self, transform: Arc<dyn InPlaceTransform>)

Append a pre-boxed in-place stage.

Source

pub fn push_external(&mut self, external: ExternalTransform)

Append an external (child-stdio) stage.

Source

pub fn transform_rows_inplace(&self, rows: &mut [Row]) -> Result<()>

Transform owned rows in place (sync path — in-place stages only).

Empty pipeline: no-op with no stage dispatch. External stages are not supported here; use crate::pipeline::BatchTransformer::transform_rows (async).

Source

pub fn transform_changes_inplace(&self, changes: &mut [Change]) -> Result<()>

Transform owned changes in place (sync path — in-place stages only).

Empty pipeline: no-op with no stage dispatch. External stages are not supported here; use crate::pipeline::BatchTransformer::transform_changes (async).

Source

pub fn apply_rows(&self, rows: Vec<Row>) -> Result<Vec<Row>>

Consume an owned row batch, transform in place, and return it.

Preferred path for in-place-only pipelines: empty pipeline is a pure move with no transform dispatch.

Source

pub fn apply_changes(&self, changes: Vec<Change>) -> Result<Vec<Change>>

Consume an owned change batch, transform in place, and return it.

Source

pub fn transform_relation_changes_inplace( &self, changes: &mut [RelationChange], ) -> Result<()>

Transform owned relation changes in place (sync — in-place stages only).

Source

pub fn transform_relations_inplace( &self, relations: &mut [Relation], ) -> Result<()>

Transform owned relations in place (sync — in-place stages only).

Source

pub fn apply_relation_changes( &self, changes: Vec<RelationChange>, ) -> Result<Vec<RelationChange>>

Consume owned relation changes, transform in place, return them.

Source

pub fn apply_relations(&self, relations: Vec<Relation>) -> Result<Vec<Relation>>

Consume owned relations, transform in place, return them.

Trait Implementations§

Source§

impl BatchTransformer for Pipeline

Source§

fn is_identity(&self) -> bool

Whether transform dispatch can be skipped entirely (empty pipeline). Read more
Source§

fn transform_changes<'life0, 'async_trait>( &'life0 self, batch_id: u64, changes: Vec<Change>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Change>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Transform an owned change batch. batch_id is monotonic per apply run.
Source§

fn transform_rows<'life0, 'async_trait>( &'life0 self, batch_id: u64, rows: Vec<Row>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Row>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Transform an owned row batch.
Source§

fn transform_relation_changes<'life0, 'async_trait>( &'life0 self, batch_id: u64, changes: Vec<RelationChange>, ) -> Pin<Box<dyn Future<Output = Result<Vec<RelationChange>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Transform an owned relation-change batch. Read more
Source§

fn transform_relations<'life0, 'async_trait>( &'life0 self, batch_id: u64, relations: Vec<Relation>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Relation>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Transform an owned relation (full-sync) batch. Read more
Source§

fn transform_events<'life0, 'async_trait>( &'life0 self, batch_id: u64, events: Vec<ApplyEvent>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ApplyEvent>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Transform a mixed apply-event batch, preserving order. Read more
Source§

impl Clone for Pipeline

Source§

fn clone(&self) -> Pipeline

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Pipeline

Source§

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

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

impl Default for Pipeline

Source§

fn default() -> Pipeline

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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.

Source§

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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