pub struct ProvenanceBuilder { /* private fields */ }Expand description
Builder for ProvenanceHeader.
Collects relations in a Vec so callers don’t have to think about inline
vs overflow slots. On build, the first INLINE_RELATION_SLOTS relations
are packed inline; any remainder is signalled by setting overflow_ref.
Overflow record storage is the caller’s responsibility; the builder just records the pointer.
Implementations§
Source§impl ProvenanceBuilder
impl ProvenanceBuilder
Sourcepub fn new(node_type: ProvNodeType, node_id: u64) -> Self
pub fn new(node_type: ProvNodeType, node_id: u64) -> Self
Start a new builder for a given PROV node.
Sourcepub fn with_timestamp(self, ts: HlcTimestamp) -> Self
pub fn with_timestamp(self, ts: HlcTimestamp) -> Self
Set the HLC timestamp for the PROV event.
Sourcepub fn with_relation(self, kind: ProvRelationKind, target_id: u64) -> Self
pub fn with_relation(self, kind: ProvRelationKind, target_id: u64) -> Self
Add a PROV-O relation edge. None kind is rejected by
ProvenanceBuilder::build.
Sourcepub fn with_overflow_ref(self, overflow_ref: u64) -> Self
pub fn with_overflow_ref(self, overflow_ref: u64) -> Self
Explicitly set the overflow record pointer. Callers typically let
build set this automatically when more than 4 relations are added.
Sourcepub fn build(self) -> Result<ProvenanceHeader, ProvenanceError>
pub fn build(self) -> Result<ProvenanceHeader, ProvenanceError>
Finalise the builder and validate the result.
If more than INLINE_RELATION_SLOTS relations were added and
Self::with_overflow_ref was not called explicitly,
ProvenanceError::OverflowNotSet is returned - callers must make
the overflow record accessible through an out-of-band ID.
Trait Implementations§
Source§impl Clone for ProvenanceBuilder
impl Clone for ProvenanceBuilder
Source§fn clone(&self) -> ProvenanceBuilder
fn clone(&self) -> ProvenanceBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more