Expand description
Window lifecycle management
This module provides the WindowManager for managing the complete lifecycle of windows:
- Creating windows based on event timestamps
- Tracking active windows and their states
- Triggering window evaluation based on watermarks
- Cleaning up completed windows
- Merging session windows
§Example
use processor::window::{
WindowManager, TumblingWindowAssigner, OnWatermarkTrigger,
};
use processor::aggregation::{CompositeAggregator, AggregationResult};
use chrono::{Duration, Utc};
// Create a window manager with 5-minute tumbling windows
let assigner = TumblingWindowAssigner::new(Duration::minutes(5));
let trigger = OnWatermarkTrigger::new();
let mut manager = WindowManager::new(assigner, trigger);
// Process events
let event_time = Utc::now();
let windows = manager.assign_event(event_time)?;
// Check which windows should fire based on watermark
let watermark = Utc::now();
let ready_windows = manager.check_triggers(watermark)?;Structs§
- Window
Manager - Manager for window lifecycles
- Window
Metadata - Metadata for an active window
- Window
Stats - Statistics tracked for each window