pub struct SourceProvenance {
pub source_kind: SourceKind,
pub source_uri: String,
pub origin_id: Option<String>,
pub fingerprint: Option<String>,
pub captured_at: Option<DateTime<Utc>>,
pub imported_at: DateTime<Utc>,
pub metadata: HashMap<String, String>,
}Expand description
Provenance metadata shared by all ingesters.
This supports consistent source attribution and deterministic re-ingestion.
Fields§
§source_kind: SourceKindWhat kind of source produced the content.
source_uri: StringStable source URI/path (e.g., file:///..., notes://...).
origin_id: Option<String>Optional upstream source identifier (e.g., Apple Note ID, Photos asset ID).
fingerprint: Option<String>Optional content fingerprint (checksum, hash, opaque digest).
captured_at: Option<DateTime<Utc>>When the source artifact was originally created/captured, if known.
imported_at: DateTime<Utc>When this provenance record was created during import.
metadata: HashMap<String, String>Arbitrary source-specific metadata.
Implementations§
Source§impl SourceProvenance
impl SourceProvenance
Sourcepub fn new(source_kind: SourceKind, source_uri: impl Into<String>) -> Self
pub fn new(source_kind: SourceKind, source_uri: impl Into<String>) -> Self
Create a new provenance record.
Sourcepub fn with_origin_id(self, origin_id: impl Into<String>) -> Self
pub fn with_origin_id(self, origin_id: impl Into<String>) -> Self
Set the upstream origin ID.
Sourcepub fn with_fingerprint(self, fingerprint: impl Into<String>) -> Self
pub fn with_fingerprint(self, fingerprint: impl Into<String>) -> Self
Set the source fingerprint.
Sourcepub fn with_captured_at(self, captured_at: DateTime<Utc>) -> Self
pub fn with_captured_at(self, captured_at: DateTime<Utc>) -> Self
Set the capture timestamp.
Sourcepub fn with_metadata(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add a source-specific metadata key/value pair.
Sourcepub fn idempotency_key(&self) -> String
pub fn idempotency_key(&self) -> String
Generate a deterministic idempotency key for de-duplication.
Preference order:
origin_id(best external identity)fingerprint(content identity)source_uri(path identity fallback)
Sourcepub fn metadata_pairs(&self) -> Vec<(String, String)>
pub fn metadata_pairs(&self) -> Vec<(String, String)>
Export normalized metadata pairs for attaching to knowledge entries.
Keys are namespaced under source.*.
Trait Implementations§
Source§impl Clone for SourceProvenance
impl Clone for SourceProvenance
Source§fn clone(&self) -> SourceProvenance
fn clone(&self) -> SourceProvenance
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SourceProvenance
impl Debug for SourceProvenance
Source§impl<'de> Deserialize<'de> for SourceProvenance
impl<'de> Deserialize<'de> for SourceProvenance
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for SourceProvenance
impl RefUnwindSafe for SourceProvenance
impl Send for SourceProvenance
impl Sync for SourceProvenance
impl Unpin for SourceProvenance
impl UnsafeUnpin for SourceProvenance
impl UnwindSafe for SourceProvenance
Blanket Implementations§
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request