-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.rs
More file actions
85 lines (71 loc) · 2.97 KB
/
lib.rs
File metadata and controls
85 lines (71 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//! # RustKernel Behavioral Analytics
//!
//! GPU-accelerated behavioral analytics kernels for profiling and forensics.
//!
//! ## Kernels
//! - `BehavioralProfiling` - Feature extraction for user behavior
//! - `AnomalyProfiling` - Deviation scoring from behavioral baseline
//! - `FraudSignatureDetection` - Known fraud pattern matching
//! - `CausalGraphConstruction` - DAG inference from event streams
//! - `ForensicQueryExecution` - Historical pattern search and analysis
//! - `EventCorrelationKernel` - Temporal event correlation and clustering
#![warn(missing_docs)]
pub mod causal;
pub mod correlation;
pub mod forensics;
pub mod profiling;
pub mod signatures;
pub mod types;
/// Prelude for convenient imports.
pub mod prelude {
pub use crate::causal::*;
pub use crate::correlation::*;
pub use crate::forensics::*;
pub use crate::profiling::*;
pub use crate::signatures::*;
pub use crate::types::*;
}
// Re-export main kernels
pub use causal::CausalGraphConstruction;
pub use correlation::EventCorrelationKernel;
pub use forensics::ForensicQueryExecution;
pub use profiling::{AnomalyProfiling, BehavioralProfiling};
pub use signatures::FraudSignatureDetection;
// Re-export key types
pub use types::{
AnomalyResult, AnomalyType, BehaviorProfile, CausalEdge, CausalGraphResult, CausalNode,
CorrelationCluster, CorrelationResult, CorrelationType, EventCorrelation, EventValue,
FeatureDeviation, ForensicQuery, ForensicResult, FraudSignature, ProfilingResult, QueryType,
SignatureMatch, SignaturePattern, UserEvent,
};
/// Register all behavioral kernels with a registry.
pub fn register_all(
registry: &rustkernel_core::registry::KernelRegistry,
) -> rustkernel_core::error::Result<()> {
tracing::info!("Registering behavioral analytics kernels");
// Profiling kernels (2) - Ring
registry.register_ring_metadata_from(profiling::BehavioralProfiling::new)?;
registry.register_ring_metadata_from(profiling::AnomalyProfiling::new)?;
// Signature detection kernel (1) - Ring
registry.register_ring_metadata_from(signatures::FraudSignatureDetection::new)?;
// Causal kernel (1) - Batch (uses register_ring_metadata_from because it only
// implements GpuKernel, not BatchKernel<I, O>; computation is via static methods)
registry.register_ring_metadata_from(causal::CausalGraphConstruction::new)?;
// Forensics kernel (1) - Batch (same as above)
registry.register_ring_metadata_from(forensics::ForensicQueryExecution::new)?;
// Correlation kernel (1) - Ring
registry.register_ring_metadata_from(correlation::EventCorrelationKernel::new)?;
tracing::info!("Registered 6 behavioral analytics kernels");
Ok(())
}
#[cfg(test)]
mod tests {
use super::*;
use rustkernel_core::registry::KernelRegistry;
#[test]
fn test_register_all() {
let registry = KernelRegistry::new();
register_all(®istry).expect("Failed to register behavioral kernels");
assert_eq!(registry.total_count(), 6);
}
}