pub struct DualCommitStore {
pub slot0: Option<CommittedGenerationBytes>,
pub slot1: Option<CommittedGenerationBytes>,
}Expand description
DualCommitStore
Dual-slot protected commit protocol for encoded ledger generations.
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.
Fields§
§slot0: Option<CommittedGenerationBytes>First physical commit slot.
slot1: Option<CommittedGenerationBytes>Second physical commit slot.
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.
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 write_corrupt_inactive_slot(&mut self, generation: u64, payload: Vec<u8>)
pub fn write_corrupt_inactive_slot(&mut self, generation: u64, payload: Vec<u8>)
Simulate a torn write into the inactive slot.
This helper is intentionally part of the model because recovery behavior is an ABI requirement, not an implementation detail.
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 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 ==.