pub struct ReasoningLedger { /* private fields */ }Expand description
Validated append-only reasoning participant content.
Implementations§
Source§impl ReasoningLedger
impl ReasoningLedger
Sourcepub fn records(&self) -> &[ReasoningRecord]
pub fn records(&self) -> &[ReasoningRecord]
Borrow validated records in canonical order.
use graphforge_knowledge::ReasoningLedger;
let mut ledger = ReasoningLedger::default();
ledger.records.clear();Sourcepub fn into_records(self) -> Vec<ReasoningRecord>
pub fn into_records(self) -> Vec<ReasoningRecord>
Consume this ledger and return its validated records in canonical order.
Sourcepub fn new(records: Vec<ReasoningRecord>) -> Result<Self, KnowledgeError>
pub fn new(records: Vec<ReasoningRecord>) -> Result<Self, KnowledgeError>
Validate, sort, and construct one complete participant.
Sourcepub fn merge(&self, staged: &Self) -> Result<Self, KnowledgeError>
pub fn merge(&self, staged: &Self) -> Result<Self, KnowledgeError>
Merge staged append-only records with idempotent exact replay.
Both inputs are validated ledgers and the row vector is private, so existing records cannot be mutated after validation. The only new whole-ledger condition is the combined row limit. A staged row that refers to a base-only predecessor is rejected while constructing the staged ledger because its predecessor is missing there. If the staged ledger includes that base row to satisfy its own chain, merge accepts it only as exact replay. Base rows cannot point to newly appended rows, since the base ledger was already validated without those identities. Therefore a cycle spanning base and staged rows is unreachable, while any identity reuse is exact replay or a conflict.
Sourcepub fn append(&self, record: ReasoningRecord) -> Result<Self, KnowledgeError>
pub fn append(&self, record: ReasoningRecord) -> Result<Self, KnowledgeError>
Append one record to this validated ledger without revalidating stored rows.
The incoming record is validated because its fields are public. The existing ledger is immutable and already validated, so only combined identity, predecessor, assertion, cycle, and row-limit conditions are checked against its trusted records.
Sourcepub fn record_fingerprint(
&self,
reasoning_uuid: Uuid,
) -> Result<[u8; 32], KnowledgeError>
pub fn record_fingerprint( &self, reasoning_uuid: Uuid, ) -> Result<[u8; 32], KnowledgeError>
Canonical fingerprint over the exact immutable record.
Sourcepub fn current_for(&self, assertion_uuid: Uuid) -> Option<&ReasoningRecord>
pub fn current_for(&self, assertion_uuid: Uuid) -> Option<&ReasoningRecord>
Resolve the current leaf without mutating or hiding branch history.
Sourcepub fn batch(&self) -> Result<RecordBatch, KnowledgeError>
pub fn batch(&self) -> Result<RecordBatch, KnowledgeError>
Build the authoritative Arrow batch.
Sourcepub fn from_batches(batches: &[RecordBatch]) -> Result<Self, KnowledgeError>
pub fn from_batches(batches: &[RecordBatch]) -> Result<Self, KnowledgeError>
Decode authoritative batches and revalidate the complete ledger.
Trait Implementations§
Source§impl Clone for ReasoningLedger
impl Clone for ReasoningLedger
Source§impl Debug for ReasoningLedger
impl Debug for ReasoningLedger
Source§impl Default for ReasoningLedger
impl Default for ReasoningLedger
impl Eq for ReasoningLedger
Source§impl PartialEq for ReasoningLedger
impl PartialEq for ReasoningLedger
impl StructuralPartialEq for ReasoningLedger
Auto Trait Implementations§
impl Freeze for ReasoningLedger
impl RefUnwindSafe for ReasoningLedger
impl Send for ReasoningLedger
impl Sync for ReasoningLedger
impl Unpin for ReasoningLedger
impl UnsafeUnpin for ReasoningLedger
impl UnwindSafe for ReasoningLedger
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.