pub struct AlgorithmRunLedger { /* private fields */ }Expand description
Validated immutable run identities and append-only lifecycle events.
The validated row collections cannot be mutated after construction:
use graphforge_knowledge::AlgorithmRunLedger;
let mut ledger = AlgorithmRunLedger::default();
ledger.runs.clear();Implementations§
Source§impl AlgorithmRunLedger
impl AlgorithmRunLedger
Sourcepub fn new(
runs: Vec<AlgorithmRun>,
events: Vec<AlgorithmRunEvent>,
) -> Result<Self, KnowledgeError>
pub fn new( runs: Vec<AlgorithmRun>, events: Vec<AlgorithmRunEvent>, ) -> Result<Self, KnowledgeError>
Validate and normalize complete run tables.
Sourcepub fn merge(&self, staged: &Self) -> Result<Self, KnowledgeError>
pub fn merge(&self, staged: &Self) -> Result<Self, KnowledgeError>
Merge immutable identities and events, rejecting conflicting reuse.
Sourcepub fn append_events(
&self,
appended: Vec<AlgorithmRunEvent>,
) -> Result<Self, KnowledgeError>
pub fn append_events( &self, appended: Vec<AlgorithmRunEvent>, ) -> Result<Self, KnowledgeError>
Append validated terminal events to this trusted ledger.
Public event fields are checked once on input. Existing run and event rows are immutable after construction, so the combined identity, ownership, time, start/terminal-count, ordering, and row-limit invariants are checked without repeating their row validators.
Sourcepub fn runs(&self) -> &[AlgorithmRun]
pub fn runs(&self) -> &[AlgorithmRun]
Run identities in canonical order.
Sourcepub fn events(&self) -> &[AlgorithmRunEvent]
pub fn events(&self) -> &[AlgorithmRunEvent]
Lifecycle events in canonical order.
Sourcepub fn into_runs(self) -> Vec<AlgorithmRun>
pub fn into_runs(self) -> Vec<AlgorithmRun>
Consume the ledger and return its run identities.
Sourcepub fn into_events(self) -> Vec<AlgorithmRunEvent>
pub fn into_events(self) -> Vec<AlgorithmRunEvent>
Consume the ledger and return its lifecycle events.
Sourcepub fn into_parts(self) -> (Vec<AlgorithmRun>, Vec<AlgorithmRunEvent>)
pub fn into_parts(self) -> (Vec<AlgorithmRun>, Vec<AlgorithmRunEvent>)
Consume the ledger and return both canonical row collections.
Sourcepub fn run(&self, run_uuid: Uuid) -> Option<&AlgorithmRun>
pub fn run(&self, run_uuid: Uuid) -> Option<&AlgorithmRun>
Locate one run.
Sourcepub fn events_for(&self, run_uuid: Uuid) -> Vec<AlgorithmRunEvent>
pub fn events_for(&self, run_uuid: Uuid) -> Vec<AlgorithmRunEvent>
Return lifecycle events for one run in canonical order.
Sourcepub fn terminal_event(&self, run_uuid: Uuid) -> Option<&AlgorithmRunEvent>
pub fn terminal_event(&self, run_uuid: Uuid) -> Option<&AlgorithmRunEvent>
Return the terminal event, when one exists.
Sourcepub fn run_batch(&self) -> Result<RecordBatch, KnowledgeError>
pub fn run_batch(&self) -> Result<RecordBatch, KnowledgeError>
Encode the authoritative run table.
Sourcepub fn event_batch(&self) -> Result<RecordBatch, KnowledgeError>
pub fn event_batch(&self) -> Result<RecordBatch, KnowledgeError>
Encode the authoritative event table.
Sourcepub fn from_batches(
run_batches: &[RecordBatch],
event_batches: &[RecordBatch],
) -> Result<Self, KnowledgeError>
pub fn from_batches( run_batches: &[RecordBatch], event_batches: &[RecordBatch], ) -> Result<Self, KnowledgeError>
Decode, validate, and normalize persisted tables.
Trait Implementations§
Source§impl Clone for AlgorithmRunLedger
impl Clone for AlgorithmRunLedger
Source§impl Debug for AlgorithmRunLedger
impl Debug for AlgorithmRunLedger
Source§impl Default for AlgorithmRunLedger
impl Default for AlgorithmRunLedger
impl Eq for AlgorithmRunLedger
Source§impl PartialEq for AlgorithmRunLedger
impl PartialEq for AlgorithmRunLedger
impl StructuralPartialEq for AlgorithmRunLedger
Auto Trait Implementations§
impl Freeze for AlgorithmRunLedger
impl RefUnwindSafe for AlgorithmRunLedger
impl Send for AlgorithmRunLedger
impl Sync for AlgorithmRunLedger
impl Unpin for AlgorithmRunLedger
impl UnsafeUnpin for AlgorithmRunLedger
impl UnwindSafe for AlgorithmRunLedger
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.