Skip to main content

PackedSeedStore

Struct PackedSeedStore 

Source
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

Source

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.

Source

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.

Source

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.

Source

pub fn root(&self) -> &Path

The store root.

Source

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.

Source

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.

Source

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.

Source

pub fn fetch(&self, id: &NodeId) -> Result<Vec<u8>>

Fetch a node, verifying NodeId::of_node(bytes) == id.

Source

pub fn fetch_range(&self, id: &NodeId, offset: u64, len: u64) -> Result<Vec<u8>>

Fetch len bytes at offset (strict; no EOF clip, no whole-node gate).

Source

pub fn has(&self, id: &NodeId) -> Result<bool>

Whether id is present.

Source

pub fn entries(&self) -> Result<Vec<(NodeId, u64)>>

Every stored (id, canonical_len), sorted ascending.

Trait Implementations§

Source§

impl Debug for PackedSeedStore

Source§

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

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

impl SeedStore for PackedSeedStore

Source§

fn put_node(&mut self, canonical: &[u8]) -> Result<NodeId>

Store the canonical bytes of one node, returning its content id. Read more
Source§

fn get_node(&self, id: &NodeId) -> Result<Vec<u8>>

Fetch the exact canonical bytes for id. Read more
Source§

fn get_node_range(&self, id: &NodeId, offset: u64, len: u64) -> Result<Vec<u8>>

Fetch len bytes of id starting at offset (strict; no EOF clip).
Source§

fn contains_node(&self, id: &NodeId) -> Result<bool>

Whether id is present.
Source§

fn list_nodes(&self) -> Result<Vec<(NodeId, u64)>>

Every stored (id, canonical_len), for closure checking and GC.

Auto Trait Implementations§

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.