Struct ProvenanceBuilder
pub struct ProvenanceBuilder {
node_type: ProvNodeType,
node_id: u64,
relations: Vec<ProvRelation>,
overflow_ref: Option<u64>,
prov_timestamp: HlcTimestamp,
plan_id: Option<u64>,
}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.
Fields§
§node_type: ProvNodeType§node_id: u64§relations: Vec<ProvRelation>§overflow_ref: Option<u64>§prov_timestamp: HlcTimestamp§plan_id: Option<u64>Implementations§
§impl ProvenanceBuilder
impl ProvenanceBuilder
pub fn new(node_type: ProvNodeType, node_id: u64) -> ProvenanceBuilder
pub fn new(node_type: ProvNodeType, node_id: u64) -> ProvenanceBuilder
Start a new builder for a given PROV node.
pub fn with_timestamp(self, ts: HlcTimestamp) -> ProvenanceBuilder
pub fn with_timestamp(self, ts: HlcTimestamp) -> ProvenanceBuilder
Set the HLC timestamp for the PROV event.
pub fn with_plan(self, plan_id: u64) -> ProvenanceBuilder
pub fn with_plan(self, plan_id: u64) -> ProvenanceBuilder
Set the Plan ID this activity follows (if any).
pub fn with_relation(
self,
kind: ProvRelationKind,
target_id: u64,
) -> ProvenanceBuilder
pub fn with_relation( self, kind: ProvRelationKind, target_id: u64, ) -> ProvenanceBuilder
Add a PROV-O relation edge. None kind is rejected by
ProvenanceBuilder::build.
pub fn with_overflow_ref(self, overflow_ref: u64) -> ProvenanceBuilder
pub fn with_overflow_ref(self, overflow_ref: u64) -> ProvenanceBuilder
Explicitly set the overflow record pointer. Callers typically let
build set this automatically when more than 4 relations are added.
pub 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§
§impl Clone for ProvenanceBuilder
impl Clone for ProvenanceBuilder
§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 moreAuto Trait Implementations§
impl Freeze for ProvenanceBuilder
impl RefUnwindSafe for ProvenanceBuilder
impl Send for ProvenanceBuilder
impl Sync for ProvenanceBuilder
impl Unpin for ProvenanceBuilder
impl UnwindSafe for ProvenanceBuilder
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
§fn deserialize(
&self,
deserializer: &mut D,
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more