pub struct RuntimeEngine { /* private fields */ }Expand description
Wraps a CorrelationEngine (or a plain Engine) and provides the interface the runtime needs: process events, reload rules, and query state.
Implementations§
Source§impl RuntimeEngine
impl RuntimeEngine
pub fn new( rules_path: PathBuf, pipelines: Vec<Pipeline>, corr_config: CorrelationConfig, include_event: bool, ) -> Self
Sourcepub fn load_rules(&mut self) -> Result<EngineStats, String>
pub fn load_rules(&mut self) -> Result<EngineStats, String>
Load (or reload) rules from the configured path.
On reload, correlation state is exported before replacing the engine and re-imported after, so in-flight windows and suppression state survive rule changes (entries for removed correlations are dropped).
Sourcepub fn process_batch<E: Event + Sync>(
&mut self,
events: &[&E],
) -> Vec<ProcessResult>
pub fn process_batch<E: Event + Sync>( &mut self, events: &[&E], ) -> Vec<ProcessResult>
Process a batch of events using parallel detection + sequential correlation.
Delegates to Engine::evaluate_batch or CorrelationEngine::process_batch
depending on whether correlation rules are loaded.
Sourcepub fn stats(&self) -> EngineStats
pub fn stats(&self) -> EngineStats
Return summary statistics about the current engine state.
Sourcepub fn rules_path(&self) -> &Path
pub fn rules_path(&self) -> &Path
Return the path from which rules are loaded.
Sourcepub fn corr_config(&self) -> &CorrelationConfig
pub fn corr_config(&self) -> &CorrelationConfig
Return the correlation configuration.
Sourcepub fn include_event(&self) -> bool
pub fn include_event(&self) -> bool
Whether detection results include the matched event.
Sourcepub fn export_state(&self) -> Option<CorrelationSnapshot>
pub fn export_state(&self) -> Option<CorrelationSnapshot>
Export correlation state as a serializable snapshot.
Returns None if the engine is detection-only (no correlation state to persist).
Sourcepub fn import_state(&mut self, snapshot: &CorrelationSnapshot) -> bool
pub fn import_state(&mut self, snapshot: &CorrelationSnapshot) -> bool
Import previously exported correlation state.
Returns true if the import succeeded, false if the snapshot version
is incompatible. No-op (returns true) if the engine is detection-only.
Auto Trait Implementations§
impl Freeze for RuntimeEngine
impl RefUnwindSafe for RuntimeEngine
impl Send for RuntimeEngine
impl Sync for RuntimeEngine
impl Unpin for RuntimeEngine
impl UnsafeUnpin for RuntimeEngine
impl UnwindSafe for RuntimeEngine
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
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>
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>
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