pub struct RiskLayer { /* private fields */ }Expand description
A validated, runnable risk layer.
Immutable after construction and cheap to hold behind an Arc, so it can be
swapped atomically on hot-reload while the sink task keeps a live snapshot
for the duration of a batch.
Implementations§
Source§impl RiskLayer
impl RiskLayer
Sourcepub fn risk_event_nats_subject(&self) -> Option<&str>
pub fn risk_event_nats_subject(&self) -> Option<&str>
The optional NATS subject override for emitted risk events.
Sourcepub fn incident_config(&self) -> Option<&IncidentConfig>
pub fn incident_config(&self) -> Option<&IncidentConfig>
The validated incident config, if the accumulator is enabled.
Sourcepub fn incident_nats_subject(&self) -> Option<&str>
pub fn incident_nats_subject(&self) -> Option<&str>
The optional NATS subject override for emitted risk incidents.
Sourcepub fn process(
&self,
results: ProcessResult,
state: &mut RiskState,
now: i64,
metrics: &dyn MetricsHook,
) -> RiskOutput
pub fn process( &self, results: ProcessResult, state: &mut RiskState, now: i64, metrics: &dyn MetricsHook, ) -> RiskOutput
Annotate each in-scope detection with its risk score and risk objects,
accumulate per-entity risk (emitting incidents on threshold crossings),
and (opt-in) emit a compact risk event per (detection, risk object)
pair. Out-of-scope results pass through untouched.
Sourcepub fn tick(&self, state: &mut RiskState, now: i64, metrics: &dyn MetricsHook)
pub fn tick(&self, state: &mut RiskState, now: i64, metrics: &dyn MetricsHook)
Advance time: prune entities whose windows have aged out and refresh the open-entity and state-entry gauges. A no-op when the accumulator is off.
Sourcepub fn snapshot(&self, state: &RiskState) -> RiskStateSnapshot
pub fn snapshot(&self, state: &RiskState) -> RiskStateSnapshot
Capture the accumulator into a versioned persistence snapshot.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RiskLayer
impl RefUnwindSafe for RiskLayer
impl Send for RiskLayer
impl Sync for RiskLayer
impl Unpin for RiskLayer
impl UnsafeUnpin for RiskLayer
impl UnwindSafe for RiskLayer
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointerSource§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, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&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