Skip to main content

entrenar/monitor/inference/provenance/
edge.rs

1//! Provenance edge types for causal relationships.
2
3use super::node::NodeId;
4use serde::{Deserialize, Serialize};
5
6/// Causal relation between nodes
7#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
8pub enum CausalRelation {
9    /// Data flowed from source to sink
10    DataFlow,
11    /// Inference triggered by input
12    Triggered,
13    /// Decision influenced by
14    Influenced,
15    /// Action caused by decision
16    Caused,
17}
18
19/// Edge in provenance graph (directed, acyclic)
20#[derive(Clone, Debug, Serialize, Deserialize)]
21pub struct ProvenanceEdge {
22    /// Source node
23    pub from: NodeId,
24    /// Destination node
25    pub to: NodeId,
26    /// Causal relation
27    pub relation: CausalRelation,
28    /// Timestamp in nanoseconds
29    pub timestamp_ns: u64,
30}