pub trait SessionStorage: Send {
// Required methods
fn metadata(&self) -> SessionMetadata;
fn get_leaf_id(&self) -> Option<String>;
fn set_leaf_id(&mut self, leaf_id: Option<&str>) -> Result<(), String>;
fn create_entry_id(&self) -> String;
fn append_entry(&mut self, entry: SessionEntry) -> Result<(), String>;
fn get_entry(&self, id: &str) -> Option<SessionEntry>;
fn find_entries(&self, type_name: &str) -> Vec<SessionEntry>;
fn get_label(&self, id: &str) -> Option<String>;
fn get_path_to_root(
&self,
leaf_id: Option<&str>,
) -> Result<Vec<SessionEntry>, String>;
fn get_entries(&self) -> Vec<SessionEntry>;
fn path(&self) -> Option<&Path>;
}Expand description
Low-level CRUD abstraction for session persistence.
Pi-compatible: provides leaf management, label tracking, path queries,
and entry CRUD. Session builds on this for the high-level API.
Required Methods§
Sourcefn metadata(&self) -> SessionMetadata
fn metadata(&self) -> SessionMetadata
Return header-derived metadata.
Sourcefn get_leaf_id(&self) -> Option<String>
fn get_leaf_id(&self) -> Option<String>
Get the current leaf entry ID (the last non-leaf entry, resolved through leaf entries).
Returns None if no entries exist.
Sourcefn set_leaf_id(&mut self, leaf_id: Option<&str>) -> Result<(), String>
fn set_leaf_id(&mut self, leaf_id: Option<&str>) -> Result<(), String>
Persist a leaf entry that records the active session-tree leaf.
None means reset to no leaf.
Sourcefn create_entry_id(&self) -> String
fn create_entry_id(&self) -> String
Generate a unique 8-character hex entry ID, collision-checked.
Sourcefn append_entry(&mut self, entry: SessionEntry) -> Result<(), String>
fn append_entry(&mut self, entry: SessionEntry) -> Result<(), String>
Append a fully-constructed entry. Updates in-memory state and persists to disk.
Sourcefn get_entry(&self, id: &str) -> Option<SessionEntry>
fn get_entry(&self, id: &str) -> Option<SessionEntry>
Look up an entry by ID.
Sourcefn find_entries(&self, type_name: &str) -> Vec<SessionEntry>
fn find_entries(&self, type_name: &str) -> Vec<SessionEntry>
Find all entries of the given type string.
Sourcefn get_label(&self, id: &str) -> Option<String>
fn get_label(&self, id: &str) -> Option<String>
Get the human-readable label for an entry, if any.
Sourcefn get_path_to_root(
&self,
leaf_id: Option<&str>,
) -> Result<Vec<SessionEntry>, String>
fn get_path_to_root( &self, leaf_id: Option<&str>, ) -> Result<Vec<SessionEntry>, String>
Walk from leaf_id (or current leaf, if None) to root, returning entries in path order.
Sourcefn get_entries(&self) -> Vec<SessionEntry>
fn get_entries(&self) -> Vec<SessionEntry>
Return all entries in insertion order.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".