Struct ProvenanceHeader
#[repr(C)]pub struct ProvenanceHeader {
pub node_type: ProvNodeType,
pub node_id: u64,
pub relations: [ProvRelation; 4],
pub overflow_ref: Option<u64>,
pub prov_timestamp: HlcTimestamp,
pub plan_id: Option<u64>,
}Expand description
PROV-O attribution metadata attached to a message envelope.
- Absent:
MessageEnvelope::provenance == None- 1 byte overhead. - Present: ~
size_of::<ProvenanceHeader>()bytes inline (verified by test [tests::test_provenance_header_size]). The spec notes a ~88 byte target; actual size depends on natural alignment and is asserted in the test module. - With >4 relations: one extra cache line referenced by
overflow_ref(caller owns that off-band record).
Fields§
§node_type: ProvNodeTypeClassification of the node this header describes.
node_id: u64Globally unique PROV node ID (Entity/Activity/Agent/Plan).
relations: [ProvRelation; 4]Inline PROV relations. Empty slots have kind == ProvRelationKind::None.
When more than 4 relations are needed, callers set overflow_ref.
overflow_ref: Option<u64>Optional off-band pointer to an extended relations record. None
when all relations fit inline.
prov_timestamp: HlcTimestampHLC timestamp of the PROV event (generation / attribution time).
plan_id: Option<u64>Optional Plan ID when this activity is executed under a Plan.
Implementations§
§impl ProvenanceHeader
impl ProvenanceHeader
pub const fn new(node_type: ProvNodeType, node_id: u64) -> ProvenanceHeader
pub const fn new(node_type: ProvNodeType, node_id: u64) -> ProvenanceHeader
Construct a header with all empty relation slots.
pub fn relation_count(&self) -> usize
pub fn relation_count(&self) -> usize
Number of populated inline relations.
pub const fn has_overflow(&self) -> bool
pub const fn has_overflow(&self) -> bool
Whether any overflow relations are referenced.
pub fn iter_relations(&self) -> impl Iterator<Item = &ProvRelation>
pub fn iter_relations(&self) -> impl Iterator<Item = &ProvRelation>
Iterate over the populated inline relations.
pub fn find_relation(&self, kind: ProvRelationKind) -> Option<&ProvRelation>
pub fn find_relation(&self, kind: ProvRelationKind) -> Option<&ProvRelation>
Find the first relation of a given kind, if present inline.
pub fn validate(&self) -> Result<(), ProvenanceError>
pub fn validate(&self) -> Result<(), ProvenanceError>
Validate structural invariants that are cheap to check.
node_idmust be non-zero (0 is reserved as “unset”).- At most one self-loop is allowed (would indicate a cycle).
- Relation kinds must be consistent with the declared
node_typewhen they have an expected source type.
Trait Implementations§
§impl Archive for ProvenanceHeaderwhere
ProvNodeType: Archive,
u64: Archive,
[ProvRelation; 4]: Archive,
Option<u64>: Archive,
HlcTimestamp: Archive,
impl Archive for ProvenanceHeaderwhere
ProvNodeType: Archive,
u64: Archive,
[ProvRelation; 4]: Archive,
Option<u64>: Archive,
HlcTimestamp: Archive,
§type Archived = ArchivedProvenanceHeader
type Archived = ArchivedProvenanceHeader
§type Resolver = ProvenanceHeaderResolver
type Resolver = ProvenanceHeaderResolver
§unsafe fn resolve(
&self,
pos: usize,
resolver: <ProvenanceHeader as Archive>::Resolver,
out: *mut <ProvenanceHeader as Archive>::Archived,
)
unsafe fn resolve( &self, pos: usize, resolver: <ProvenanceHeader as Archive>::Resolver, out: *mut <ProvenanceHeader as Archive>::Archived, )
§impl Clone for ProvenanceHeader
impl Clone for ProvenanceHeader
§fn clone(&self) -> ProvenanceHeader
fn clone(&self) -> ProvenanceHeader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ProvenanceHeader
impl Debug for ProvenanceHeader
§impl Default for ProvenanceHeader
impl Default for ProvenanceHeader
§fn default() -> ProvenanceHeader
fn default() -> ProvenanceHeader
§impl<__D> Deserialize<ProvenanceHeader, __D> for <ProvenanceHeader as Archive>::Archivedwhere
__D: Fallible + ?Sized,
ProvNodeType: Archive,
<ProvNodeType as Archive>::Archived: Deserialize<ProvNodeType, __D>,
u64: Archive,
<u64 as Archive>::Archived: Deserialize<u64, __D>,
[ProvRelation; 4]: Archive,
<[ProvRelation; 4] as Archive>::Archived: Deserialize<[ProvRelation; 4], __D>,
Option<u64>: Archive,
<Option<u64> as Archive>::Archived: Deserialize<Option<u64>, __D>,
HlcTimestamp: Archive,
<HlcTimestamp as Archive>::Archived: Deserialize<HlcTimestamp, __D>,
impl<__D> Deserialize<ProvenanceHeader, __D> for <ProvenanceHeader as Archive>::Archivedwhere
__D: Fallible + ?Sized,
ProvNodeType: Archive,
<ProvNodeType as Archive>::Archived: Deserialize<ProvNodeType, __D>,
u64: Archive,
<u64 as Archive>::Archived: Deserialize<u64, __D>,
[ProvRelation; 4]: Archive,
<[ProvRelation; 4] as Archive>::Archived: Deserialize<[ProvRelation; 4], __D>,
Option<u64>: Archive,
<Option<u64> as Archive>::Archived: Deserialize<Option<u64>, __D>,
HlcTimestamp: Archive,
<HlcTimestamp as Archive>::Archived: Deserialize<HlcTimestamp, __D>,
§fn deserialize(
&self,
deserializer: &mut __D,
) -> Result<ProvenanceHeader, <__D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut __D, ) -> Result<ProvenanceHeader, <__D as Fallible>::Error>
§impl PartialEq for ProvenanceHeader
impl PartialEq for ProvenanceHeader
§impl<__S> Serialize<__S> for ProvenanceHeaderwhere
__S: Fallible + ?Sized,
ProvNodeType: Serialize<__S>,
u64: Serialize<__S>,
[ProvRelation; 4]: Serialize<__S>,
Option<u64>: Serialize<__S>,
HlcTimestamp: Serialize<__S>,
impl<__S> Serialize<__S> for ProvenanceHeaderwhere
__S: Fallible + ?Sized,
ProvNodeType: Serialize<__S>,
u64: Serialize<__S>,
[ProvRelation; 4]: Serialize<__S>,
Option<u64>: Serialize<__S>,
HlcTimestamp: Serialize<__S>,
§fn serialize(
&self,
serializer: &mut __S,
) -> Result<<ProvenanceHeader as Archive>::Resolver, <__S as Fallible>::Error>
fn serialize( &self, serializer: &mut __S, ) -> Result<<ProvenanceHeader as Archive>::Resolver, <__S as Fallible>::Error>
impl Copy for ProvenanceHeader
impl Eq for ProvenanceHeader
impl StructuralPartialEq for ProvenanceHeader
Auto Trait Implementations§
impl Freeze for ProvenanceHeader
impl RefUnwindSafe for ProvenanceHeader
impl Send for ProvenanceHeader
impl Sync for ProvenanceHeader
impl Unpin for ProvenanceHeader
impl UnwindSafe for ProvenanceHeader
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
§impl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere
T: Archive,
§type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
Archive, it may be unsized. Read more§type MetadataResolver = ()
type MetadataResolver = ()
§unsafe fn resolve_metadata(
&self,
_: usize,
_: <T as ArchiveUnsized>::MetadataResolver,
_: *mut <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata,
)
unsafe fn resolve_metadata( &self, _: usize, _: <T as ArchiveUnsized>::MetadataResolver, _: *mut <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata, )
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