pub struct StreamPipelineBuilder { /* private fields */ }Expand description
Builder for constructing stream processing pipelines
Provides a fluent API for configuring all aspects of a stream processing pipeline including windows, watermarks, state backends, and operators.
§Example
use processor::pipeline::StreamPipelineBuilder;
use processor::config::{WindowConfig, StateBackend};
use std::time::Duration;
let pipeline = StreamPipelineBuilder::new()
.with_name("my-pipeline")
.with_description("Processes user events")
.with_parallelism(8)
.with_window(WindowConfig::tumbling(60_000))
.with_watermark_delay(Duration::from_secs(10))
.with_state_backend(StateBackend::Memory)
.with_buffer_size(50_000)
.with_tag("production")
.with_tag("user-events")
.build()?;Implementations§
Source§impl StreamPipelineBuilder
impl StreamPipelineBuilder
Sourcepub fn with_name<S: Into<String>>(self, name: S) -> Self
pub fn with_name<S: Into<String>>(self, name: S) -> Self
Set the pipeline name
§Example
let builder = StreamPipelineBuilder::new()
.with_name("user-event-processor");Sourcepub fn with_description<S: Into<String>>(self, description: S) -> Self
pub fn with_description<S: Into<String>>(self, description: S) -> Self
Set the pipeline description
Add multiple tags to the pipeline
Sourcepub fn with_parallelism(self, parallelism: usize) -> Self
pub fn with_parallelism(self, parallelism: usize) -> Self
Set the number of parallel processing workers
§Example
let builder = StreamPipelineBuilder::new()
.with_parallelism(16);Sourcepub fn with_buffer_size(self, buffer_size: usize) -> Self
pub fn with_buffer_size(self, buffer_size: usize) -> Self
Set the event buffer size
Sourcepub fn with_metrics(self, enabled: bool) -> Self
pub fn with_metrics(self, enabled: bool) -> Self
Enable or disable metrics collection
Sourcepub fn with_window(self, window: WindowConfig) -> Self
pub fn with_window(self, window: WindowConfig) -> Self
Set the window configuration
§Example
let builder = StreamPipelineBuilder::new()
.with_window(WindowConfig::tumbling(60_000));Sourcepub fn with_tumbling_window(self, size_ms: u64) -> Self
pub fn with_tumbling_window(self, size_ms: u64) -> Self
Sourcepub fn with_sliding_window(self, size_ms: u64, slide_ms: u64) -> Self
pub fn with_sliding_window(self, size_ms: u64, slide_ms: u64) -> Self
Sourcepub fn with_session_window(self, gap_ms: u64) -> Self
pub fn with_session_window(self, gap_ms: u64) -> Self
Sourcepub fn with_allowed_lateness(self, lateness_ms: u64) -> Self
pub fn with_allowed_lateness(self, lateness_ms: u64) -> Self
Set allowed lateness for late events
Sourcepub fn with_drop_late_events(self, drop: bool) -> Self
pub fn with_drop_late_events(self, drop: bool) -> Self
Set whether to drop late events
Sourcepub fn with_watermark_config(self, watermark: WatermarkConfig) -> Self
pub fn with_watermark_config(self, watermark: WatermarkConfig) -> Self
Set the watermark configuration
Sourcepub fn with_watermark_delay(self, delay: Duration) -> Self
pub fn with_watermark_delay(self, delay: Duration) -> Self
Set the watermark delay (max out-of-orderness)
§Example
let builder = StreamPipelineBuilder::new()
.with_watermark_delay(Duration::from_secs(10));Sourcepub fn with_idle_timeout(self, timeout: Duration) -> Self
pub fn with_idle_timeout(self, timeout: Duration) -> Self
Set the idle source timeout
Sourcepub fn with_watermark_interval(self, interval: Duration) -> Self
pub fn with_watermark_interval(self, interval: Duration) -> Self
Set the watermark update interval
Sourcepub fn with_state_backend(self, backend: StateBackend) -> Self
pub fn with_state_backend(self, backend: StateBackend) -> Self
Set the state backend
§Example
let builder = StreamPipelineBuilder::new()
.with_state_backend(StateBackend::Memory);Sourcepub fn with_state_path<S: Into<PathBuf>>(self, path: S) -> Self
pub fn with_state_path<S: Into<PathBuf>>(self, path: S) -> Self
Set the state storage path (for file-based backends)
Sourcepub fn with_checkpoint_interval(self, interval: Duration) -> Self
pub fn with_checkpoint_interval(self, interval: Duration) -> Self
Set the checkpoint interval
Sourcepub fn with_incremental_checkpoints(self, enabled: bool) -> Self
pub fn with_incremental_checkpoints(self, enabled: bool) -> Self
Enable or disable incremental checkpoints
Sourcepub fn with_checkpoint_retention(self, count: usize) -> Self
pub fn with_checkpoint_retention(self, count: usize) -> Self
Set the number of checkpoints to retain
Sourcepub fn with_state_ttl(self, ttl: Duration) -> Self
pub fn with_state_ttl(self, ttl: Duration) -> Self
Set state TTL (time-to-live)
Sourcepub fn with_max_state_size(self, size_bytes: u64) -> Self
pub fn with_max_state_size(self, size_bytes: u64) -> Self
Set maximum state size for memory backends
Sourcepub fn with_state_compression(self, enabled: bool) -> Self
pub fn with_state_compression(self, enabled: bool) -> Self
Enable state compression
Sourcepub fn with_percentiles(self, percentiles: Vec<u8>) -> Self
pub fn with_percentiles(self, percentiles: Vec<u8>) -> Self
Set aggregation percentiles to compute
Sourcepub fn with_histogram_buckets(self, buckets: Vec<f64>) -> Self
pub fn with_histogram_buckets(self, buckets: Vec<f64>) -> Self
Set histogram buckets
Sourcepub fn with_min_samples(self, min: usize) -> Self
pub fn with_min_samples(self, min: usize) -> Self
Set minimum samples required for aggregation
Sourcepub fn with_max_samples(self, max: usize) -> Self
pub fn with_max_samples(self, max: usize) -> Self
Set maximum samples to keep in memory
Sourcepub fn with_outlier_removal(self, threshold: f64) -> Self
pub fn with_outlier_removal(self, threshold: f64) -> Self
Enable outlier detection and removal
Sourcepub fn with_deduplication(self, enabled: bool, ttl: Duration) -> Self
pub fn with_deduplication(self, enabled: bool, ttl: Duration) -> Self
Enable event deduplication
§Example
let builder = StreamPipelineBuilder::new()
.with_deduplication(true, Duration::from_secs(3600));Sourcepub fn with_deduplication_config(self, config: DeduplicationConfig) -> Self
pub fn with_deduplication_config(self, config: DeduplicationConfig) -> Self
Set the deduplication configuration
§Example
let dedup_config = DeduplicationConfig::new()
.enabled()
.with_ttl(Duration::from_secs(7200))
.with_strategy(DeduplicationStrategy::EventId);
let builder = StreamPipelineBuilder::new()
.with_deduplication_config(dedup_config);Sourcepub fn with_deduplication_ttl(self, ttl: Duration) -> Self
pub fn with_deduplication_ttl(self, ttl: Duration) -> Self
Set the deduplication TTL
§Example
let builder = StreamPipelineBuilder::new()
.with_deduplication_ttl(Duration::from_secs(3600));Sourcepub fn with_deduplication_strategy(
self,
strategy: DeduplicationStrategy,
) -> Self
pub fn with_deduplication_strategy( self, strategy: DeduplicationStrategy, ) -> Self
Set the deduplication strategy
§Example
let builder = StreamPipelineBuilder::new()
.with_deduplication_strategy(DeduplicationStrategy::ContentHash);Sourcepub fn with_deduplication_redis_prefix<S: Into<String>>(self, prefix: S) -> Self
pub fn with_deduplication_redis_prefix<S: Into<String>>(self, prefix: S) -> Self
Set the Redis key prefix for deduplication
§Example
let builder = StreamPipelineBuilder::new()
.with_deduplication_redis_prefix("myapp:dedup");Sourcepub fn with_normalization(self, enabled: bool, interval: Duration) -> Self
pub fn with_normalization(self, enabled: bool, interval: Duration) -> Self
Enable time-series normalization
§Example
let builder = StreamPipelineBuilder::new()
.with_normalization(true, Duration::from_secs(5));Sourcepub fn with_normalization_config(self, config: NormalizationConfig) -> Self
pub fn with_normalization_config(self, config: NormalizationConfig) -> Self
Set the normalization configuration
§Example
let norm_config = NormalizationConfig::new()
.enabled()
.with_interval(Duration::from_secs(5))
.with_fill_strategy(FillStrategy::LinearInterpolation)
.with_alignment(AlignmentStrategy::Start);
let builder = StreamPipelineBuilder::new()
.with_normalization_config(norm_config);Sourcepub fn with_normalization_interval(self, interval: Duration) -> Self
pub fn with_normalization_interval(self, interval: Duration) -> Self
Set the normalization interval
§Example
let builder = StreamPipelineBuilder::new()
.with_normalization_interval(Duration::from_secs(5));Sourcepub fn with_fill_strategy(self, strategy: FillStrategy) -> Self
pub fn with_fill_strategy(self, strategy: FillStrategy) -> Self
Set the fill strategy for normalization
§Example
let builder = StreamPipelineBuilder::new()
.with_fill_strategy(FillStrategy::LinearInterpolation);Sourcepub fn with_alignment_strategy(self, strategy: AlignmentStrategy) -> Self
pub fn with_alignment_strategy(self, strategy: AlignmentStrategy) -> Self
Set the alignment strategy for normalization
§Example
let builder = StreamPipelineBuilder::new()
.with_alignment_strategy(AlignmentStrategy::Start);Sourcepub fn with_normalization_buffer_size(self, size: usize) -> Self
pub fn with_normalization_buffer_size(self, size: usize) -> Self
Set the normalization buffer size
§Example
let builder = StreamPipelineBuilder::new()
.with_normalization_buffer_size(2000);Sourcepub fn with_interpolation_max_gap(self, gap: Duration) -> Self
pub fn with_interpolation_max_gap(self, gap: Duration) -> Self
Set the interpolation max gap for normalization
§Example
let builder = StreamPipelineBuilder::new()
.with_interpolation_max_gap(Duration::from_secs(10));Sourcepub fn with_normalization_outlier_detection(self, threshold: f64) -> Self
pub fn with_normalization_outlier_detection(self, threshold: f64) -> Self
Enable outlier detection in normalization
§Example
let builder = StreamPipelineBuilder::new()
.with_normalization_outlier_detection(3.0);Trait Implementations§
Auto Trait Implementations§
impl Freeze for StreamPipelineBuilder
impl RefUnwindSafe for StreamPipelineBuilder
impl Send for StreamPipelineBuilder
impl Sync for StreamPipelineBuilder
impl Unpin for StreamPipelineBuilder
impl UnsafeUnpin for StreamPipelineBuilder
impl UnwindSafe for StreamPipelineBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.