rust_rule_engine/streaming/
mod.rs1#[cfg(feature = "streaming")]
38pub mod aggregator;
39#[cfg(feature = "streaming")]
40pub mod engine;
41#[cfg(feature = "streaming")]
42pub mod event;
43#[cfg(feature = "streaming")]
44pub mod window;
45
46#[cfg(feature = "streaming")]
47pub use aggregator::{AggregationType, Aggregator};
48#[cfg(feature = "streaming")]
49pub use engine::StreamRuleEngine;
50#[cfg(feature = "streaming")]
51pub use event::{EventMetadata, StreamEvent};
52#[cfg(feature = "streaming")]
53pub use window::{TimeWindow, WindowManager, WindowType};
54
55#[cfg(not(feature = "streaming"))]
57pub struct StreamRuleEngine;
58
59#[cfg(not(feature = "streaming"))]
60impl StreamRuleEngine {
61 pub fn new() -> Self {
63 StreamRuleEngine
64 }
65
66 pub fn with_config(_config: StreamConfig) -> Self {
68 panic!("StreamRuleEngine configuration methods require the 'streaming' feature to be enabled. Enable it in Cargo.toml: features = [\"streaming\"]");
69 }
70
71 pub async fn add_rule(&mut self, _grl_rule: &str) -> Result<()> {
73 Err(crate::RuleEngineError::FeatureNotEnabled {
74 feature: "streaming".to_string(),
75 message: "Streaming rule engine requires the 'streaming' feature to be enabled".to_string(),
76 })
77 }
78
79 pub async fn add_rule_file<P: AsRef<std::path::Path>>(&mut self, _path: P) -> Result<()> {
81 Err(crate::RuleEngineError::FeatureNotEnabled {
82 feature: "streaming".to_string(),
83 message: "Streaming rule engine requires the 'streaming' feature to be enabled".to_string(),
84 })
85 }
86
87 pub async fn register_action_handler<F>(&self, _action_type: &str, _handler: F)
89 where
90 F: Fn(&StreamAction) + Send + Sync + 'static,
91 {
92 panic!("StreamRuleEngine action handlers require the 'streaming' feature to be enabled. Enable it in Cargo.toml: features = [\"streaming\"]");
93 }
94
95 pub async fn start(&mut self) -> Result<()> {
97 Err(crate::RuleEngineError::FeatureNotEnabled {
98 feature: "streaming".to_string(),
99 message: "Streaming rule engine requires the 'streaming' feature to be enabled".to_string(),
100 })
101 }
102
103 pub async fn stop(&self) {
105 panic!("StreamRuleEngine stop method requires the 'streaming' feature to be enabled. Enable it in Cargo.toml: features = [\"streaming\"]");
106 }
107
108 pub async fn send_event(&self, _event: StreamEvent) -> Result<()> {
110 Err(crate::RuleEngineError::FeatureNotEnabled {
111 feature: "streaming".to_string(),
112 message: "Streaming rule engine requires the 'streaming' feature to be enabled".to_string(),
113 })
114 }
115
116 pub async fn execute_rules(&mut self) -> Result<StreamExecutionResult> {
118 Err(crate::RuleEngineError::FeatureNotEnabled {
119 feature: "streaming".to_string(),
120 message: "Streaming rule engine requires the 'streaming' feature to be enabled".to_string(),
121 })
122 }
123
124 pub async fn get_window_statistics(&self) -> crate::streaming::window::WindowStatistics {
126 panic!("StreamRuleEngine window statistics require the 'streaming' feature to be enabled. Enable it in Cargo.toml: features = [\"streaming\"]");
127 }
128
129 pub async fn get_field_analytics(&self, _field: &str) -> std::collections::HashMap<String, crate::types::Value> {
131 panic!("StreamRuleEngine field analytics require the 'streaming' feature to be enabled. Enable it in Cargo.toml: features = [\"streaming\"]");
132 }
133
134 pub async fn is_running(&self) -> bool {
136 panic!("StreamRuleEngine running status requires the 'streaming' feature to be enabled. Enable it in Cargo.toml: features = [\"streaming\"]");
137 }
138}