pub struct Provenance {
pub parents: Vec<ObjectId>,
pub operation: String,
pub agent: String,
pub timestamp: u64,
pub metadata: HashMap<String, SochValue>,
}Expand description
Records how a Knowledge Object was derived.
Provenance enables auditable lineage tracking: “Where did this fact come from?” “What transformations produced this summary?” Each provenance record forms a node in a DAG (Directed Acyclic Graph) of derivations.
The provenance chain is hash-linked — each object’s OID is derived from its content (which includes parent OIDs), creating a tamper-evident lineage.
Fields§
§parents: Vec<ObjectId>OIDs of the parent objects this was derived from. Empty for root/original objects.
operation: StringThe transformation or operation that produced this object. Examples: “chunk”, “summarize”, “extract_entities”, “merge”, “user_input”
agent: StringThe agent or system that performed the transformation. Examples: “gpt-4”, “user:alice”, “sochdb:compaction”
timestamp: u64Timestamp when the derivation occurred (HLC-encoded microseconds).
metadata: HashMap<String, SochValue>Optional metadata about the transformation.
Implementations§
Source§impl Provenance
impl Provenance
Sourcepub fn root(agent: impl Into<String>, timestamp: u64) -> Self
pub fn root(agent: impl Into<String>, timestamp: u64) -> Self
Create a root provenance (no parents — this is an original object).
Sourcepub fn derived(
parents: Vec<ObjectId>,
operation: impl Into<String>,
agent: impl Into<String>,
timestamp: u64,
) -> Self
pub fn derived( parents: Vec<ObjectId>, operation: impl Into<String>, agent: impl Into<String>, timestamp: u64, ) -> Self
Create a derived provenance with parent objects.
Sourcepub fn with_metadata(self, key: impl Into<String>, value: SochValue) -> Self
pub fn with_metadata(self, key: impl Into<String>, value: SochValue) -> Self
Add metadata to this provenance record.
Trait Implementations§
Source§impl Clone for Provenance
impl Clone for Provenance
Source§fn clone(&self) -> Provenance
fn clone(&self) -> Provenance
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more