Expand description
Data streaming and live updates for Presentar.
This module provides infrastructure for real-time data updates:
- Subscription management for data sources
- Message protocol for updates
- Reconnection and backpressure handling
- Integration with expression executor for live transforms
§Example
use presentar_core::streaming::{
DataStream, StreamConfig, StreamMessage, StreamSubscription,
};
// Create a subscription
let sub = StreamSubscription::new("metrics/cpu")
.with_interval(1000) // 1 second
.with_transform("rate()");
// Handle incoming messages
fn handle_message(msg: StreamMessage) {
match msg {
StreamMessage::Data { payload, .. } => println!("Got data: {:?}", payload),
StreamMessage::Error { message, .. } => eprintln!("Error: {}", message),
_ => {}
}
}Structs§
- Data
Stream - Data stream manager.
- Message
Buffer - Message buffer for ordering and deduplication.
- Rate
Limiter - Rate limiter for backpressure handling.
- Reconnect
Config - Reconnection configuration.
- Stream
Config - Configuration for stream connection.
- Stream
Subscription - Subscription to a data source.
Enums§
- Connection
State - Stream connection state.
- Stream
Message - Stream message types for the protocol.
Type Aliases§
- Data
Callback - Callback type for data updates.
- Error
Callback - Callback type for errors.
- State
Callback - Callback type for connection state changes.