pub struct PackedSeedStore { /* private fields */ }Expand description
A packed content-addressed store of canonical procedural seed nodes.
Implements SeedStore with the same identity, bytes, verification, range,
and enumeration semantics as super::FsSeedStore; only the physical layout
differs (fieldpack/ segments instead of one file per node).
Implementations§
Source§impl PackedSeedStore
impl PackedSeedStore
Sourcepub fn open_read(root: impl AsRef<Path>, io: IoCounters) -> Result<Self>
pub fn open_read(root: impl AsRef<Path>, io: IoCounters) -> Result<Self>
Open the store read-only: sealed segments via their .idx, plus the open
segment (if any) recovered by a framing scan.
Sourcepub fn open_write(root: impl AsRef<Path>, io: IoCounters) -> Result<Self>
pub fn open_write(root: impl AsRef<Path>, io: IoCounters) -> Result<Self>
Open the store read-write, recovering (and truncating the torn tail of) an unsealed segment so appends continue from the last complete record.
Uses the default SyncPolicy::Batch.
Sourcepub fn open_write_with_policy(
root: impl AsRef<Path>,
io: IoCounters,
policy: SyncPolicy,
) -> Result<Self>
pub fn open_write_with_policy( root: impl AsRef<Path>, io: IoCounters, policy: SyncPolicy, ) -> Result<Self>
Open the store read-write with an explicit durability SyncPolicy.
Sourcepub fn seal(&self) -> Result<()>
pub fn seal(&self) -> Result<()>
Seal the open segment: fsync it, publish seg-N.idx atomically, and make
it readable. Called by crate::field::FieldStore::sync.
Sourcepub fn insert(&self, canonical: &[u8]) -> Result<NodeId>
pub fn insert(&self, canonical: &[u8]) -> Result<NodeId>
Store the canonical bytes of one node (idempotent).
With SyncPolicy::Each the record is fdatasync’d before returning;
with the default SyncPolicy::Batch it is visible immediately (through
the pending map) but becomes crash-durable at the next seal or
PackedSeedStore::flush. See the module docs for the exact semantics.
Sourcepub fn flush(&self) -> Result<()>
pub fn flush(&self) -> Result<()>
Force every appended record in the open segment to stable storage without
sealing it. A durability barrier, not a visibility change: the pending map
already serves every appended node. Called by
FieldStore::put_field so a published manifest
only ever references nodes that are already durable.
Sourcepub fn fetch(&self, id: &NodeId) -> Result<Vec<u8>>
pub fn fetch(&self, id: &NodeId) -> Result<Vec<u8>>
Fetch a node, verifying NodeId::of_node(bytes) == id.
Trait Implementations§
Source§impl Debug for PackedSeedStore
impl Debug for PackedSeedStore
Source§impl SeedStore for PackedSeedStore
impl SeedStore for PackedSeedStore
Source§fn put_node(&mut self, canonical: &[u8]) -> Result<NodeId>
fn put_node(&mut self, canonical: &[u8]) -> Result<NodeId>
Source§fn get_node(&self, id: &NodeId) -> Result<Vec<u8>>
fn get_node(&self, id: &NodeId) -> Result<Vec<u8>>
id. Read more