pub struct ArtifactPreferenceLedger {
pub events: Vec<ArtifactPreferenceEvent>,
}Expand description
Validated append-only artifact-preference table.
Fields§
§events: Vec<ArtifactPreferenceEvent>Events ordered by (recorded_at, preference_event_uuid).
Implementations§
Source§impl ArtifactPreferenceLedger
impl ArtifactPreferenceLedger
Sourcepub fn new(events: Vec<ArtifactPreferenceEvent>) -> Result<Self, KnowledgeError>
pub fn new(events: Vec<ArtifactPreferenceEvent>) -> Result<Self, KnowledgeError>
Validate, sort, and construct a preference table.
Sourcepub fn merge(&self, staged: &Self) -> Result<Self, KnowledgeError>
pub fn merge(&self, staged: &Self) -> Result<Self, KnowledgeError>
Merge staged rows into an existing ledger.
Sourcepub fn preference_fingerprint(
&self,
preference_event_uuid: Uuid,
) -> Result<[u8; 32], KnowledgeError>
pub fn preference_fingerprint( &self, preference_event_uuid: Uuid, ) -> Result<[u8; 32], KnowledgeError>
Canonical semantic fingerprint over caller-supplied preference-event content.
Excludes prior_artifact_uuid (ledger-derived), provenance_uuid, and
recorded_at_micros (clock-derived) so that a retry with the same caller-provided
content compares equal to the committed row regardless of when it was retried.
Sourcepub fn preference_request_fingerprint(
preference_event_uuid: Uuid,
source_uuid: Uuid,
artifact_uuid: Uuid,
reason: &str,
) -> Result<[u8; 32], KnowledgeError>
pub fn preference_request_fingerprint( preference_event_uuid: Uuid, source_uuid: Uuid, artifact_uuid: Uuid, reason: &str, ) -> Result<[u8; 32], KnowledgeError>
Canonical semantic fingerprint for caller-supplied preference request fields.
Identical to preference_fingerprint but computed from raw caller-provided fields
rather than requiring a committed ledger row. Used to compare an incoming request
against the already-committed row before constructing the full staged event.
Sourcepub fn current_preferred_artifact(&self, source_uuid: Uuid) -> Option<Uuid>
pub fn current_preferred_artifact(&self, source_uuid: Uuid) -> Option<Uuid>
Return the current preferred Artifact for one Source, if any.
Sourcepub fn batch(&self) -> Result<RecordBatch, KnowledgeError>
pub fn batch(&self) -> Result<RecordBatch, KnowledgeError>
Encode the authoritative Arrow batch.
Sourcepub fn from_batches(batches: &[RecordBatch]) -> Result<Self, KnowledgeError>
pub fn from_batches(batches: &[RecordBatch]) -> Result<Self, KnowledgeError>
Decode one or more Arrow batches.
Trait Implementations§
Source§impl Clone for ArtifactPreferenceLedger
impl Clone for ArtifactPreferenceLedger
Source§impl Debug for ArtifactPreferenceLedger
impl Debug for ArtifactPreferenceLedger
Source§impl Default for ArtifactPreferenceLedger
impl Default for ArtifactPreferenceLedger
impl Eq for ArtifactPreferenceLedger
Source§impl PartialEq for ArtifactPreferenceLedger
impl PartialEq for ArtifactPreferenceLedger
impl StructuralPartialEq for ArtifactPreferenceLedger
Auto Trait Implementations§
impl Freeze for ArtifactPreferenceLedger
impl RefUnwindSafe for ArtifactPreferenceLedger
impl Send for ArtifactPreferenceLedger
impl Sync for ArtifactPreferenceLedger
impl Unpin for ArtifactPreferenceLedger
impl UnsafeUnpin for ArtifactPreferenceLedger
impl UnwindSafe for ArtifactPreferenceLedger
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.