Module window

Module window 

Source
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 windows
  • WindowTrigger: Determines when to emit window results
  • LateDataPolicy: Handles elements arriving after window closes

§Window Types

  • TumblingWindowAssigner: Fixed-size, non-overlapping windows
  • SlidingWindowAssigner: Fixed-size, overlapping windows
  • SessionWindow: 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§

BoundedOutOfOrdernessGenerator
Generates watermarks allowing for bounded out-of-orderness.
CountTrigger
Trigger that fires after a specified count of elements.
CountWindow
A count-based window that holds a fixed number of elements.
CountWindowAssigner
Count-based tumbling window assigner.
EventTimeTrigger
Default trigger that fires when the watermark passes the window end.
GlobalWindow
Global window that contains all elements.
GlobalWindowAssigner
Global window assigner that assigns all elements to a single window.
LateDataHandler
Handles late data according to the configured policy.
LateDataStats
Statistics about late data processing.
MonotonicWatermarkGenerator
Generates watermarks that follow the maximum observed timestamp exactly.
NeverTrigger
Trigger that never fires (for global windows).
PeriodicWatermarkGenerator
Generates watermarks at fixed intervals regardless of event arrival.
ProcessingTimeTrigger
Processing time trigger that fires at regular intervals.
SessionTrigger
Trigger that fires when the session gap timeout expires.
SessionWindow
A session window with dynamic boundaries based on activity gaps.
SessionWindowAssigner
Session window assigner that creates gap-based windows.
SlidingWindowAssigner
Sliding window assigner that creates overlapping windows.
TimeWindow
A time-based window with start and end timestamps.
TumblingWindowAssigner
Tumbling window assigner that creates non-overlapping windows.
Watermark
Represents a watermark in event-time processing.
WindowConfig
Configuration for window operations.
WindowState
Tracks the state of a window including its watermark context.

Enums§

LateDataPolicy
Policy for handling late data (elements arriving after window closes).
LateDataResult
Result of evaluating whether an element is late.
TriggerResult
Result of trigger evaluation.
WindowError
Error type for window operations.

Traits§

WatermarkGenerator
Trait for generating watermarks from observed event timestamps.
Window
Trait for window types that can be used with WindowState.
WindowAssigner
Trait for window assigners that assign elements to windows.
WindowTrigger
Trait for window triggers that determine when to emit results.

Type Aliases§

SharedWindowAssigner
Shared window assigner reference.
WindowResult
Result type for window operations.