pub struct StreamAlphaNode {
pub stream_name: String,
pub event_type: Option<String>,
pub window: Option<WindowSpec>,
/* private fields */
}Expand description
StreamAlphaNode filters events from a named stream
This node:
- Filters events by stream name
- Optionally filters by event type
- Manages time-based windows (sliding, tumbling)
- Evicts expired events automatically
Fields§
§stream_name: StringName of the stream to filter
event_type: Option<String>Optional event type filter
window: Option<WindowSpec>Window specification (if any)
Implementations§
Source§impl StreamAlphaNode
impl StreamAlphaNode
Sourcepub fn new(
stream_name: impl Into<String>,
event_type: Option<String>,
window: Option<WindowSpec>,
) -> Self
pub fn new( stream_name: impl Into<String>, event_type: Option<String>, window: Option<WindowSpec>, ) -> Self
Create a new StreamAlphaNode
§Arguments
stream_name- Name of the stream to filterevent_type- Optional event type filterwindow- Optional window specification
§Example
use rust_rule_engine::rete::stream_alpha_node::{StreamAlphaNode, WindowSpec};
use rust_rule_engine::streaming::window::WindowType;
use std::time::Duration;
// Node without window
let node = StreamAlphaNode::new("user-events", None, None);
// Node with sliding window
let window = WindowSpec {
duration: Duration::from_secs(300),
window_type: WindowType::Sliding,
};
let node = StreamAlphaNode::new("logins", Some("LoginEvent".to_string()), Some(window));Sourcepub fn with_max_events(self, max_events: usize) -> Self
pub fn with_max_events(self, max_events: usize) -> Self
Create with custom max events
Sourcepub fn process_event(&mut self, event: &StreamEvent) -> bool
pub fn process_event(&mut self, event: &StreamEvent) -> bool
Sourcepub fn get_events(&self) -> &VecDeque<StreamEvent>
pub fn get_events(&self) -> &VecDeque<StreamEvent>
Get all events currently in the window
§Returns
A slice of events that are within the current window
Sourcepub fn event_count(&self) -> usize
pub fn event_count(&self) -> usize
Get count of events in window
Sourcepub fn window_stats(&self) -> WindowStats
pub fn window_stats(&self) -> WindowStats
Get window statistics
Trait Implementations§
Source§impl Clone for StreamAlphaNode
impl Clone for StreamAlphaNode
Source§fn clone(&self) -> StreamAlphaNode
fn clone(&self) -> StreamAlphaNode
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for StreamAlphaNode
impl RefUnwindSafe for StreamAlphaNode
impl Send for StreamAlphaNode
impl Sync for StreamAlphaNode
impl Unpin for StreamAlphaNode
impl UnwindSafe for StreamAlphaNode
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more