pub trait SessionStorage: Send + Sync {
// Required methods
fn append_entry(
&mut self,
entry: SessionEntry,
) -> Result<String, SessionError>;
fn get_entry(&self, id: &str) -> Result<Option<SessionEntry>, SessionError>;
fn get_branch(
&self,
leaf_id: &str,
) -> Result<Vec<SessionEntry>, SessionError>;
fn move_to(
&mut self,
target_id: &str,
summary: Option<BranchSummary>,
) -> Result<Option<String>, SessionError>;
fn set_leaf_id(&mut self, id: &str) -> Result<(), SessionError>;
fn get_leaf_id(&self) -> Result<String, SessionError>;
fn append_compaction(
&mut self,
summary: String,
first_kept: String,
tokens: u32,
details: Value,
) -> Result<String, SessionError>;
}Expand description
Host-provided session storage trait. Core holds no I/O; the host implements persistence.
Required Methods§
fn append_entry(&mut self, entry: SessionEntry) -> Result<String, SessionError>
fn get_entry(&self, id: &str) -> Result<Option<SessionEntry>, SessionError>
fn get_branch(&self, leaf_id: &str) -> Result<Vec<SessionEntry>, SessionError>
fn move_to( &mut self, target_id: &str, summary: Option<BranchSummary>, ) -> Result<Option<String>, SessionError>
fn set_leaf_id(&mut self, id: &str) -> Result<(), SessionError>
fn get_leaf_id(&self) -> Result<String, SessionError>
fn append_compaction( &mut self, summary: String, first_kept: String, tokens: u32, details: Value, ) -> Result<String, SessionError>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".