logos.std.data.persistent.handle

Module std · package logos-std

Types

structContainerRef

struct ContainerRef

Handles one map container in a snap: owns the root rc and embeds the snap-side SnapCtx. Dropping releases the snap’s open-container claim.

Implements: Drop

Fields

arc: Arc<dyn BTreeNode>

Owns an rc share of the container root.

ctx: SnapCtx<STORE_CFG>

Embeds the shared snap-side wiring.

structDirInsertOutcome

struct DirInsertOutcome

Reports the result of a recursive dir-tree insert; on split, carries the new right subtree.

Fields

right: Option

Holds the new right subtree; Some iff split.

right_max: u64

Carries the max ctr id in the new right subtree; valid only on split.

right_max_present: bool

Mirrors split; set when right_max is meaningful.

split: bool

Indicates the node split; right/right_max are then populated.

enumInsertError

enum InsertError

Describes why a checked insert (try_insert) rejected a key or value.

Variants

KeyType
ValueType

structSnap

struct Snap

Represents a live writable snapshot: the dir-tree root plus a shared ref to its store. Dropping releases the whole dir chain; commit consumes the snap into the DAG instead.

Fields

arc: Arc<LockingStore<STORE_CFG>>

Shares the backing store.

dir: Arc<dyn BTreeNode>

Owns the snapshot’s directory-tree root.

open_containers: u64

Counts ContainerRefs open on this snap; commit panics while nonzero.

parent_id: <cfg-slot-type>

Records the commit this snap forked from; becomes the new commit’s parent.

snapshot_id: <cfg-slot-type>

Identifies this snapshot — the CoW key make_unique compares against.

structSnapCtx

struct SnapCtx

Carries the snap-side wiring a container handle embeds: dir slot, CoW key, ids, commit guard.

Fields

ctr_id: u64

Identifies this container within the dir.

dir_root_p: *mut Arc<dyn BTreeNode>

Points at Snap.dir; stable for the snap’s life.

id_ctr_p: *mut <cfg-slot-type>

Points at the store’s next_block_id.

open_ctr_p: *mut u64

Points at Snap.open_containers (the commit guard).

snap_id: <cfg-slot-type>

Keys the CoW check in make_unique.

structStore

struct Store

Wraps a shared Arc<LockingStore> — the user-facing handle to a persistent store.

Fields

arc: Arc<LockingStore<STORE_CFG>>

Shares the backing LockingStore; cloned into every forked Snap.

Functions

fncreate_ctr

fn create_ctr(snap: &mut Snap<STORE_CFG>, ctr_id: u64) -> ContainerRef<STORE_CFG, CFG>

Creates an empty container under ctr_id in the snap’s dir and returns its open handle.

fndir_insert

fn dir_insert(snap_dir: &mut Arc<dyn BTreeNode>, ctr_id: u64, val_arc: Arc<dyn BTreeNode>, cur_snapshot_id: <cfg-slot-type>, id_ctr_p: *mut <cfg-slot-type>) -> void

Inserts ctr_idval_arc into the dir tree, growing a new root on split. Takes ownership of val_arc; an existing ctr_id has its value replaced.

fndir_lookup

fn dir_lookup(snap_dir: &Arc<dyn BTreeNode>, ctr_id: u64) -> *mut Arc<dyn BTreeNode>

Finds ctr_id in the dir tree; returns its NodeARC slot pointer, or null when absent.

fnopen_ctr

fn open_ctr(snap: &mut Snap<STORE_CFG>, ctr_id: u64) -> Option

Opens the container at ctr_id: Some(ContainerRef) sharing the dir slot’s rc, else None.

fnsnap_fork

fn snap_fork(store: &mut Store<STORE_CFG>, parent_commit: <cfg-slot-type>) -> Snap<STORE_CFG>

Starts a new mutable snapshot from committed parent_commit with a fresh snapshot id.

fnstore_open

fn store_open() -> Store<STORE_CFG>

Creates a store seeded with an empty genesis commit at id GENESIS.