pub struct StreamExecutor { /* private fields */ }Expand description
Stream executor manages real-time data streams
Implementations§
Source§impl StreamExecutor
impl StreamExecutor
Sourcepub fn new(plugin_loader: Arc<RwLock<PluginLoader>>) -> Self
pub fn new(plugin_loader: Arc<RwLock<PluginLoader>>) -> Self
Create a new stream executor
Sourcepub fn with_evaluator(
plugin_loader: Arc<RwLock<PluginLoader>>,
evaluator: Arc<dyn ExpressionEvaluator>,
) -> Self
pub fn with_evaluator( plugin_loader: Arc<RwLock<PluginLoader>>, evaluator: Arc<dyn ExpressionEvaluator>, ) -> Self
Create a stream executor with an expression evaluator for handler execution
Sourcepub fn event_sender(&self) -> Sender<(String, StreamEvent)>
pub fn event_sender(&self) -> Sender<(String, StreamEvent)>
Get event sender for plugins to send events
Sourcepub async fn start_stream(
&mut self,
stream_def: &StreamDef,
ctx: &mut ExecutionContext,
) -> Result<()>
pub async fn start_stream( &mut self, stream_def: &StreamDef, ctx: &mut ExecutionContext, ) -> Result<()>
Start a stream from a StreamDef
Sourcepub fn stop_stream(&mut self, name: &str) -> Result<()>
pub fn stop_stream(&mut self, name: &str) -> Result<()>
Stop a running stream
Sourcepub fn handle_event(
&mut self,
stream_name: &str,
event: StreamEvent,
stream_def: &StreamDef,
ctx: &mut ExecutionContext,
) -> Result<()>
pub fn handle_event( &mut self, stream_name: &str, event: StreamEvent, stream_def: &StreamDef, ctx: &mut ExecutionContext, ) -> Result<()>
Handle an incoming event
Sourcepub async fn run_event_loop(
&mut self,
stream_defs: HashMap<String, StreamDef>,
ctx: &mut ExecutionContext,
) -> Result<()>
pub async fn run_event_loop( &mut self, stream_defs: HashMap<String, StreamDef>, ctx: &mut ExecutionContext, ) -> Result<()>
Run the event loop (call this in an async context)
Sourcepub fn list_streams(&self) -> Vec<&str>
pub fn list_streams(&self) -> Vec<&str>
Get list of running streams
Sourcepub fn is_running(&self, name: &str) -> bool
pub fn is_running(&self, name: &str) -> bool
Check if a stream is running
Sourcepub fn get_state(&self, name: &str) -> Option<&StreamState>
pub fn get_state(&self, name: &str) -> Option<&StreamState>
Get stream state for inspection
Auto Trait Implementations§
impl Freeze for StreamExecutor
impl !RefUnwindSafe for StreamExecutor
impl Send for StreamExecutor
impl Sync for StreamExecutor
impl Unpin for StreamExecutor
impl UnsafeUnpin for StreamExecutor
impl !UnwindSafe for StreamExecutor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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