pub struct JsonlSessionStorage { /* private fields */ }Expand description
File-backed storage: holds full state in memory and persists to a JSONL file. Pi-compatible: loads from file on creation, appends on every write.
Implementations§
Trait Implementations§
Source§impl SessionStorage for JsonlSessionStorage
impl SessionStorage for JsonlSessionStorage
Source§fn metadata(&self) -> SessionMetadata
fn metadata(&self) -> SessionMetadata
Return header-derived metadata.
Source§fn 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.Source§fn 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.Source§fn create_entry_id(&self) -> String
fn create_entry_id(&self) -> String
Generate a unique 8-character hex entry ID, collision-checked.
Source§fn 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.
Source§fn 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.Source§fn 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.
Source§fn 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.Source§fn get_entries(&self) -> Vec<SessionEntry>
fn get_entries(&self) -> Vec<SessionEntry>
Return all entries in insertion order.
Auto Trait Implementations§
impl Freeze for JsonlSessionStorage
impl RefUnwindSafe for JsonlSessionStorage
impl Send for JsonlSessionStorage
impl Sync for JsonlSessionStorage
impl Unpin for JsonlSessionStorage
impl UnsafeUnpin for JsonlSessionStorage
impl UnwindSafe for JsonlSessionStorage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more