logos.std.data.persistent.store

Module std · package logos-std

Traits

traitIStore

trait IStore

Narrows the cross-backend store ABI: snapshot lifecycle, DAG navigation, id allocation.

Implemented by: LockingStore

Types

structCommitEntry

struct CommitEntry

Pins one commit in the store DAG: a frozen directory-tree root plus its DAG edges.

Fields

children: Vec<<cfg-slot-type>>

Lists the commit ids forked directly from this one.

parents: Vec<<cfg-slot-type>>

Lists the immediate ancestor commit ids; empty for a root/genesis commit.

released: bool

Marks the entry as tombstoned; when set, root is a null-handle NodeARC.

root: Arc<dyn BTreeNode>

Holds the pinned directory-tree root NodeARC for this commit.

structLockingStore

struct LockingStore

Implements IStore v1: a Vec<CommitEntry> DAG guarded by a Mutex.

Implements: IStore Send Sync

Fields

dag: Vec<CommitEntry<STORE_CFG>>

Holds every commit ever registered, indexed by SnpId.

lock: Mutex<i32>

Guards all DAG reads/writes and id allocation.

next_block_id: <cfg-slot-type>

Tracks the next block id to hand out.

next_snapshot_id: <cfg-slot-type>

Tracks the next snapshot id to hand out.

structMutSnapshot

struct MutSnapshot

Holds a single-thread mutable handle onto one forked-off commit, pre-commit.

Fields

id_ctr_p: *mut <cfg-slot-type>

Points at the store’s block-id counter, letting CoW allocate ids without a store round-trip.

parent_id: <cfg-slot-type>

Identifies the commit this snapshot forked from.

root: Arc<dyn BTreeNode>

Owns one rc share of the directory-tree root being mutated.

snapshot_id: <cfg-slot-type>

Identifies this snapshot for the CoW protocol; stamped onto mutated nodes.

Functions

fnlocking_store_new

fn locking_store_new() -> LockingStore<STORE_CFG>

Creates an empty LockingStore with block/snapshot id counters both at 0.