pub struct DeltaStore { /* private fields */ }Expand description
redb-backed store for delta blobs keyed by sequence number.
The store is policy-free and gap-tolerant: it persists and retrieves deltas without enforcing continuity. Staleness and correctness gates live at consumer boundaries.
Implementations§
Source§impl DeltaStore
impl DeltaStore
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self, BootnodeError>
pub fn open(path: impl AsRef<Path>) -> Result<Self, BootnodeError>
Open or create the delta store at path.
Sourcepub fn put(&self, seq: u64, entry: &DeltaEntry) -> Result<(), BootnodeError>
pub fn put(&self, seq: u64, entry: &DeltaEntry) -> Result<(), BootnodeError>
Persist a delta. Overwrites any existing entry at the same seq.
Accepts any sequence number without requiring predecessors — gaps are a normal post-recovery state per §S.19.
Sourcepub fn put_batch<'a>(
&self,
entries: impl IntoIterator<Item = (u64, &'a DeltaEntry)>,
) -> Result<(), BootnodeError>
pub fn put_batch<'a>( &self, entries: impl IntoIterator<Item = (u64, &'a DeltaEntry)>, ) -> Result<(), BootnodeError>
Persist multiple deltas in a single write transaction.
Sourcepub fn get(&self, seq: u64) -> Result<Option<DeltaEntry>, BootnodeError>
pub fn get(&self, seq: u64) -> Result<Option<DeltaEntry>, BootnodeError>
Retrieve the delta at exactly seq, if any.
Sourcepub fn fetch_range(
&self,
from_seq: u64,
to_seq: u64,
) -> Result<Vec<(u64, DeltaEntry)>, BootnodeError>
pub fn fetch_range( &self, from_seq: u64, to_seq: u64, ) -> Result<Vec<(u64, DeltaEntry)>, BootnodeError>
Return all deltas with sequence numbers in [from_seq, to_seq) that
exist in the store, in ascending sequence order.
Gaps are signalled by missing sequence numbers in the result — the consumer detects them, not the store.
Returns BootnodeError::FetchRangeTooLarge if to_seq - from_seq
exceeds MAX_FETCH_RANGE_LEN.