pub struct AllocationLedger {
pub ledger_schema_version: u32,
pub physical_format_id: u32,
pub current_generation: u64,
pub allocation_history: AllocationHistory,
}Expand description
AllocationLedger
Durable root of allocation history.
Fields§
§ledger_schema_version: u32Ledger schema version.
physical_format_id: u32Physical encoding format identifier.
current_generation: u64Current committed generation selected by recovery.
allocation_history: AllocationHistoryHistorical allocation facts.
Implementations§
Source§impl AllocationLedger
impl AllocationLedger
Sourcepub fn validate_integrity(&self) -> Result<(), LedgerIntegrityError>
pub fn validate_integrity(&self) -> Result<(), LedgerIntegrityError>
Validate structural ledger invariants before recovery or commit.
Sourcepub fn validate_committed_integrity(&self) -> Result<(), LedgerIntegrityError>
pub fn validate_committed_integrity(&self) -> Result<(), LedgerIntegrityError>
Validate strict committed-ledger invariants before recovery or commit.
Public durable structs are DTOs: decoded or manually constructed values are untrusted until this method succeeds.
Sourcepub fn stage_validated_generation(
&self,
validated: &ValidatedAllocations,
committed_at: Option<u64>,
) -> Result<Self, AllocationStageError>
pub fn stage_validated_generation( &self, validated: &ValidatedAllocations, committed_at: Option<u64>, ) -> Result<Self, AllocationStageError>
Return a copy of the ledger with validated recorded as the next generation.
This is a pure logical update. Physical atomicity is the responsibility of the substrate commit protocol.
Sourcepub fn stage_reservation_generation(
&self,
reservations: &[AllocationDeclaration],
committed_at: Option<u64>,
) -> Result<Self, AllocationReservationError>
pub fn stage_reservation_generation( &self, reservations: &[AllocationDeclaration], committed_at: Option<u64>, ) -> Result<Self, AllocationReservationError>
Return a copy of the ledger with reservations recorded as the next generation.
This is a pure logical update. The caller is responsible for applying framework policy before staging reservations.
Sourcepub fn stage_retirement_generation(
&self,
retirement: &AllocationRetirement,
committed_at: Option<u64>,
) -> Result<Self, AllocationRetirementError>
pub fn stage_retirement_generation( &self, retirement: &AllocationRetirement, committed_at: Option<u64>, ) -> Result<Self, AllocationRetirementError>
Return a copy of the ledger with one explicit retirement committed.
Trait Implementations§
Source§impl Clone for AllocationLedger
impl Clone for AllocationLedger
Source§fn clone(&self) -> AllocationLedger
fn clone(&self) -> AllocationLedger
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AllocationLedger
impl Debug for AllocationLedger
Source§impl<'de> Deserialize<'de> for AllocationLedger
impl<'de> Deserialize<'de> for AllocationLedger
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>,
Source§impl PartialEq for AllocationLedger
impl PartialEq for AllocationLedger
Source§fn eq(&self, other: &AllocationLedger) -> bool
fn eq(&self, other: &AllocationLedger) -> bool
self and other values to be equal, and is used by ==.