pub struct VersionedDecisionLedger {
pub schema_version: String,
pub ledger_id: String,
pub created_at_unix_ms: u128,
pub last_updated_unix_ms: u128,
pub record_count: usize,
pub records: Vec<DecisionRecord>,
}Expand description
A decision ledger with explicit schema versioning for forward compatibility.
Use this struct when persisting ledgers to disk or transmitting over the wire. The schema version allows consumers to detect incompatible changes and migrate data appropriately.
Fields§
§schema_version: StringSchema version string (semver format)
ledger_id: StringLedger identifier for tracking
created_at_unix_ms: u128Unix timestamp when ledger was created (milliseconds)
last_updated_unix_ms: u128Unix timestamp of most recent record (milliseconds)
record_count: usizeTotal number of records
records: Vec<DecisionRecord>The decision records
Implementations§
Source§impl VersionedDecisionLedger
impl VersionedDecisionLedger
Sourcepub fn from_evidence_ledger(ledger: &EvidenceLedger) -> Self
pub fn from_evidence_ledger(ledger: &EvidenceLedger) -> Self
Create a new versioned ledger from an evidence ledger.
Sourcepub fn append(&mut self, record: DecisionRecord)
pub fn append(&mut self, record: DecisionRecord)
Append a decision record to the ledger.
Sourcepub fn is_schema_compatible(&self) -> bool
pub fn is_schema_compatible(&self) -> bool
Check if this ledger’s schema is compatible with current version.
Sourcepub fn validate(&self) -> LedgerValidationResult
pub fn validate(&self) -> LedgerValidationResult
Validate the ledger structure.
Sourcepub fn to_json_pretty(&self) -> Result<String, Error>
pub fn to_json_pretty(&self) -> Result<String, Error>
Serialize to JSON with pretty formatting.
Trait Implementations§
Source§impl Clone for VersionedDecisionLedger
impl Clone for VersionedDecisionLedger
Source§impl Debug for VersionedDecisionLedger
impl Debug for VersionedDecisionLedger
Source§impl<'de> Deserialize<'de> for VersionedDecisionLedger
impl<'de> Deserialize<'de> for VersionedDecisionLedger
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for VersionedDecisionLedger
impl PartialEq for VersionedDecisionLedger
Source§impl Serialize for VersionedDecisionLedger
impl Serialize for VersionedDecisionLedger
impl StructuralPartialEq for VersionedDecisionLedger
Auto Trait Implementations§
impl Freeze for VersionedDecisionLedger
impl RefUnwindSafe for VersionedDecisionLedger
impl Send for VersionedDecisionLedger
impl Sync for VersionedDecisionLedger
impl Unpin for VersionedDecisionLedger
impl UnsafeUnpin for VersionedDecisionLedger
impl UnwindSafe for VersionedDecisionLedger
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
Mutably borrows from an owned value. Read more