Module streaming

Module streaming 

Source
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§

DataStream
Data stream manager.
MessageBuffer
Message buffer for ordering and deduplication.
RateLimiter
Rate limiter for backpressure handling.
ReconnectConfig
Reconnection configuration.
StreamConfig
Configuration for stream connection.
StreamSubscription
Subscription to a data source.

Enums§

ConnectionState
Stream connection state.
StreamMessage
Stream message types for the protocol.

Type Aliases§

DataCallback
Callback type for data updates.
ErrorCallback
Callback type for errors.
StateCallback
Callback type for connection state changes.