pub struct AnomalyInjector { /* private fields */ }Expand description
Main anomaly injection engine.
Implementations§
Source§impl AnomalyInjector
impl AnomalyInjector
Sourcepub fn new(config: AnomalyInjectorConfig) -> Self
pub fn new(config: AnomalyInjectorConfig) -> Self
Creates a new anomaly injector.
Sourcepub fn process_entries(
&mut self,
entries: &mut [JournalEntry],
) -> InjectionBatchResult
pub fn process_entries( &mut self, entries: &mut [JournalEntry], ) -> InjectionBatchResult
Processes a batch of journal entries, potentially injecting anomalies.
Sourcepub fn inject_specific(
&mut self,
entry: &mut JournalEntry,
anomaly_type: AnomalyType,
) -> Option<LabeledAnomaly>
pub fn inject_specific( &mut self, entry: &mut JournalEntry, anomaly_type: AnomalyType, ) -> Option<LabeledAnomaly>
Injects a specific anomaly type into an entry.
Sourcepub fn create_self_approval(
&mut self,
entry: &mut JournalEntry,
user_id: &str,
) -> Option<LabeledAnomaly>
pub fn create_self_approval( &mut self, entry: &mut JournalEntry, user_id: &str, ) -> Option<LabeledAnomaly>
Creates a self-approval anomaly.
Sourcepub fn create_sod_violation(
&mut self,
entry: &mut JournalEntry,
user_id: &str,
conflicting_duties: (&str, &str),
) -> Option<LabeledAnomaly>
pub fn create_sod_violation( &mut self, entry: &mut JournalEntry, user_id: &str, conflicting_duties: (&str, &str), ) -> Option<LabeledAnomaly>
Creates a segregation of duties violation.
Sourcepub fn create_ic_mismatch(
&mut self,
entry: &mut JournalEntry,
matching_company: &str,
expected_amount: Decimal,
actual_amount: Decimal,
) -> Option<LabeledAnomaly>
pub fn create_ic_mismatch( &mut self, entry: &mut JournalEntry, matching_company: &str, expected_amount: Decimal, actual_amount: Decimal, ) -> Option<LabeledAnomaly>
Creates an intercompany mismatch anomaly.
Sourcepub fn get_labels(&self) -> &[LabeledAnomaly]
pub fn get_labels(&self) -> &[LabeledAnomaly]
Returns all generated labels.
Sourcepub fn get_summary(&self) -> AnomalySummary
pub fn get_summary(&self) -> AnomalySummary
Returns the anomaly summary.
Sourcepub fn get_stats(&self) -> &InjectorStats
pub fn get_stats(&self) -> &InjectorStats
Returns injection statistics.
Sourcepub fn cluster_count(&self) -> usize
pub fn cluster_count(&self) -> usize
Returns the number of clusters created.
Auto Trait Implementations§
impl Freeze for AnomalyInjector
impl RefUnwindSafe for AnomalyInjector
impl Send for AnomalyInjector
impl Sync for AnomalyInjector
impl Unpin for AnomalyInjector
impl UnwindSafe for AnomalyInjector
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