Module state

Module state 

Source
Expand description

State Management for Stream Processing

Provides stateful operators with persistence, checkpointing, and recovery capabilities. Essential for production streaming applications that need fault tolerance.

§Features

  • Stateful Operators: Maintain state across events (counters, aggregations, etc.)
  • Checkpointing: Periodic state snapshots for fault tolerance
  • Recovery: Restore state after failures
  • Multiple Backends: Memory, File, and extensible to RocksDB/Redis
  • TTL Support: Automatic state expiration

§Example

use rust_rule_engine::streaming::state::*;

// Create state store
let mut state = StateStore::new(StateBackend::Memory);

// Store and retrieve state
state.put("user_count", Value::Integer(42))?;
let count = state.get("user_count")?;

// Checkpoint for fault tolerance
state.checkpoint("checkpoint_1")?;

Structs§

CheckpointMetadata
Metadata about a checkpoint
StateConfig
Configuration for state management
StateStatistics
Statistics about state store
StateStore
Main state store for managing stateful operations
StatefulOperator
Stateful operator that maintains state across events

Enums§

StateBackend
Backend type for state storage

Type Aliases§

StateResult
Result type for state operations