Expand description
Windowing operations for stream processing.
This module provides abstractions for grouping stream elements into bounded windows for aggregation and processing.
§Overview
Windowing is fundamental to stream processing, allowing bounded computations over unbounded streams. Windows group elements based on:
- Time: Group by event time or processing time
- Count: Group by number of elements
- Session: Group by activity with gaps
§Core Concepts
TimeWindow: Represents a window boundary (start/end time)WindowAssigner: Assigns elements to windowsWindowTrigger: Determines when to emit window resultsLateDataPolicy: Handles elements arriving after window closes
§Window Types
TumblingWindowAssigner: Fixed-size, non-overlapping windowsSlidingWindowAssigner: Fixed-size, overlapping windowsSessionWindow: Gap-based dynamic windows
§Example
use streamweave::window::{TimeWindow, TumblingWindowAssigner, WindowConfig};
use std::time::Duration;
// Create a tumbling window of 5 seconds
let assigner = TumblingWindowAssigner::new(Duration::from_secs(5));Structs§
- Bounded
OutOf Orderness Generator - Generates watermarks allowing for bounded out-of-orderness.
- Count
Trigger - Trigger that fires after a specified count of elements.
- Count
Window - A count-based window that holds a fixed number of elements.
- Count
Window Assigner - Count-based tumbling window assigner.
- Event
Time Trigger - Default trigger that fires when the watermark passes the window end.
- Global
Window - Global window that contains all elements.
- Global
Window Assigner - Global window assigner that assigns all elements to a single window.
- Late
Data Handler - Handles late data according to the configured policy.
- Late
Data Stats - Statistics about late data processing.
- Monotonic
Watermark Generator - Generates watermarks that follow the maximum observed timestamp exactly.
- Never
Trigger - Trigger that never fires (for global windows).
- Periodic
Watermark Generator - Generates watermarks at fixed intervals regardless of event arrival.
- Processing
Time Trigger - Processing time trigger that fires at regular intervals.
- Session
Trigger - Trigger that fires when the session gap timeout expires.
- Session
Window - A session window with dynamic boundaries based on activity gaps.
- Session
Window Assigner - Session window assigner that creates gap-based windows.
- Sliding
Window Assigner - Sliding window assigner that creates overlapping windows.
- Time
Window - A time-based window with start and end timestamps.
- Tumbling
Window Assigner - Tumbling window assigner that creates non-overlapping windows.
- Watermark
- Represents a watermark in event-time processing.
- Window
Config - Configuration for window operations.
- Window
State - Tracks the state of a window including its watermark context.
Enums§
- Late
Data Policy - Policy for handling late data (elements arriving after window closes).
- Late
Data Result - Result of evaluating whether an element is late.
- Trigger
Result - Result of trigger evaluation.
- Window
Error - Error type for window operations.
Traits§
- Watermark
Generator - Trait for generating watermarks from observed event timestamps.
- Window
- Trait for window types that can be used with
WindowState. - Window
Assigner - Trait for window assigners that assign elements to windows.
- Window
Trigger - Trait for window triggers that determine when to emit results.
Type Aliases§
- Shared
Window Assigner - Shared window assigner reference.
- Window
Result - Result type for window operations.