pub struct InMemorySessionStorage { /* private fields */ }Expand description
Fully in-memory storage — no file I/O. Pi-compatible: owns all state (entries, labels, leaf).
Implementations§
Source§impl InMemorySessionStorage
impl InMemorySessionStorage
Sourcepub fn new(metadata: SessionMetadata) -> Self
pub fn new(metadata: SessionMetadata) -> Self
Create empty storage with explicit metadata.
Trait Implementations§
Source§impl SessionStorage for InMemorySessionStorage
impl SessionStorage for InMemorySessionStorage
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 InMemorySessionStorage
impl RefUnwindSafe for InMemorySessionStorage
impl Send for InMemorySessionStorage
impl Sync for InMemorySessionStorage
impl Unpin for InMemorySessionStorage
impl UnsafeUnpin for InMemorySessionStorage
impl UnwindSafe for InMemorySessionStorage
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