kql_panopticon/execution/processing/handler.rs
1//! Processing step handler trait
2//!
3//! Defines the interface for step handlers in the processing phase.
4
5use crate::error::Result;
6use crate::pack::ProcessingStep;
7use async_trait::async_trait;
8
9use super::context::ProcessingContext;
10use super::output::ProcessingStepOutput;
11
12/// Step type enum for processing phase
13#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
14pub enum ProcessingStepType {
15 /// Risk scoring based on indicators
16 Scoring,
17 // Future: Polars, Aggregate, Join, etc.
18}
19
20/// Handler trait for processing phase steps
21///
22/// Currently implemented by:
23/// - `ScoringStepHandler` - Risk scoring based on indicators
24#[async_trait]
25pub trait ProcessingStepHandler: Send + Sync {
26 /// Which step type this handler processes
27 fn handles(&self) -> ProcessingStepType;
28
29 /// Execute the processing step
30 ///
31 /// Processing steps:
32 /// 1. Read data from acquisition results via `ctx.acquisition_results()`
33 /// 2. Perform computation (scoring, aggregation, etc.)
34 /// 3. Write results to JSONL via `ctx.writer(step_name)`
35 /// 4. Return ProcessingStepOutput with ResultHandle
36 async fn execute(
37 &self,
38 step: &ProcessingStep,
39 ctx: &ProcessingContext<'_>,
40 ) -> Result<ProcessingStepOutput>;
41
42 /// Validate step configuration
43 fn validate(&self, step: &ProcessingStep) -> Result<()>;
44}