pub struct DualCommitStore { /* private fields */ }Expand description
DualCommitStore
Dual-slot protected commit protocol for encoded ledger generations.
This is an advanced low-level API for framework or stable-IO owners. Most applications should recover, validate, and commit through the allocation ledger flow rather than manipulating encoded physical commit slots directly.
Writers stage a complete generation record into the inactive slot. Readers recover by selecting the highest-generation valid slot. A torn or partial write cannot become authoritative unless its marker and checksum validate.
The checksum is for torn-write and accidental-corruption detection only. It is not a cryptographic hash and does not provide adversarial tamper resistance.
Implementations§
Source§impl DualCommitStore
impl DualCommitStore
Sourcepub const fn is_uninitialized(&self) -> bool
pub const fn is_uninitialized(&self) -> bool
Return true when no commit slot has ever been written.
Sourcepub const fn slot0(&self) -> Option<&CommittedGenerationBytes>
pub const fn slot0(&self) -> Option<&CommittedGenerationBytes>
Borrow the first physical commit slot.
Slot records are untrusted recovered state until recovery selects an authoritative generation.
Sourcepub const fn slot1(&self) -> Option<&CommittedGenerationBytes>
pub const fn slot1(&self) -> Option<&CommittedGenerationBytes>
Borrow the second physical commit slot.
Slot records are untrusted recovered state until recovery selects an authoritative generation.
Return the highest-generation valid committed record.
Sourcepub fn diagnostic(&self) -> CommitStoreDiagnostic
pub fn diagnostic(&self) -> CommitStoreDiagnostic
Build a read-only recovery diagnostic for the protected commit slots.
Sourcepub fn commit_payload(
&mut self,
payload: Vec<u8>,
) -> Result<&CommittedGenerationBytes, CommitRecoveryError>
pub fn commit_payload( &mut self, payload: Vec<u8>, ) -> Result<&CommittedGenerationBytes, CommitRecoveryError>
Commit a new payload to the inactive slot.
The returned store models the post-write physical state. If a real
substrate traps before the inactive slot is fully written, the prior
valid slot remains authoritative under authoritative.
Sourcepub fn commit_payload_at_generation(
&mut self,
generation: u64,
payload: Vec<u8>,
) -> Result<&CommittedGenerationBytes, CommitRecoveryError>
pub fn commit_payload_at_generation( &mut self, generation: u64, payload: Vec<u8>, ) -> Result<&CommittedGenerationBytes, CommitRecoveryError>
Commit payload as an explicitly numbered physical generation.
This is the low-level physical-slot primitive used by
crate::LedgerCommitStore. Normal ledger commits should use
crate::LedgerCommitStore::commit or crate::AllocationBootstrap so
payloads are decoded, compatibility-checked, and integrity-validated
before they can become authoritative.
The physical slot generation is checked against the recovered physical
predecessor. This method does not inspect payload.
Trait Implementations§
Source§impl Clone for DualCommitStore
impl Clone for DualCommitStore
Source§fn clone(&self) -> DualCommitStore
fn clone(&self) -> DualCommitStore
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 DualCommitStore
impl Debug for DualCommitStore
Source§impl Default for DualCommitStore
impl Default for DualCommitStore
Source§fn default() -> DualCommitStore
fn default() -> DualCommitStore
Source§impl<'de> Deserialize<'de> for DualCommitStore
impl<'de> Deserialize<'de> for DualCommitStore
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 DualProtectedCommitStore for DualCommitStore
impl DualProtectedCommitStore for DualCommitStore
Source§type Slot = CommittedGenerationBytes
type Slot = CommittedGenerationBytes
Source§fn is_uninitialized(&self) -> bool
fn is_uninitialized(&self) -> bool
Source§fn inactive_slot_index(&self) -> CommitSlotIndex
fn inactive_slot_index(&self) -> CommitSlotIndex
Source§impl PartialEq for DualCommitStore
impl PartialEq for DualCommitStore
Source§fn eq(&self, other: &DualCommitStore) -> bool
fn eq(&self, other: &DualCommitStore) -> bool
self and other values to be equal, and is used by ==.