Skip to main content

Wal

Struct Wal 

Source
pub struct Wal {
    pub header: WalHeader,
    pub records: Vec<WalRecord>,
}
Expand description

Sealed WAL — the durable read-side counterpart to WalWriter. Produced by Wal::from_writer or Wal::deserialize; consumed by Wal::verify_chain / replay_into.

Fields§

§header: WalHeader

Header pinned at writer construction.

§records: Vec<WalRecord>

Records in append order.

Implementations§

Source§

impl Wal

Source

pub fn from_writer(w: WalWriter) -> Self

Seal a WalWriter into a read-only Wal.

Source

pub fn serialize(&self) -> Result<Vec<u8>, WalError>

Encode the entire WAL (header + records) as canonical postcard bytes.

Source

pub fn deserialize(bytes: &[u8]) -> Result<Self, WalError>

Decode bytes produced by serialize.

Source

pub fn chain_tip(&self) -> [u8; 32]

Most recent record’s this_chain_hash, or zero if empty.

Source

pub fn verify_chain(&self, world_id: [u8; 32]) -> Result<(), WalError>

Verify every record’s chain hash against the keyed BLAKE3 over (prev_chain_hash || canonical body). When the header pins a verifying_key (Tier 2 — Ed25519), each record’s signature is also checked against the same body bytes. Returns Ok if every check passes.

Trait Implementations§

Source§

impl Debug for Wal

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Wal

Source§

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 Serialize for Wal

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Wal

§

impl RefUnwindSafe for Wal

§

impl Send for Wal

§

impl Sync for Wal

§

impl Unpin for Wal

§

impl UnsafeUnpin for Wal

§

impl UnwindSafe for Wal

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,