Skip to main content

LedgerCodec

Trait LedgerCodec 

Source
pub trait LedgerCodec {
    type Error;

    // Required methods
    fn encode(&self, ledger: &AllocationLedger) -> Result<Vec<u8>, Self::Error>;
    fn decode(&self, bytes: &[u8]) -> Result<AllocationLedger, Self::Error>;
}
Expand description

LedgerCodec

Integration-supplied encoding for persisted allocation ledgers.

Decoding returns an untrusted durable DTO. Callers should recover ledgers through LedgerCommitStore, which checks physical/logical generation, compatibility, and committed ledger integrity before returning authoritative state.

Required Associated Types§

Source

type Error

Encoding or decoding error type.

Required Methods§

Source

fn encode(&self, ledger: &AllocationLedger) -> Result<Vec<u8>, Self::Error>

Encode a logical allocation ledger into durable bytes.

Source

fn decode(&self, bytes: &[u8]) -> Result<AllocationLedger, Self::Error>

Decode durable bytes into a logical allocation ledger.

Implementors§