pub struct SessionManager { /* private fields */ }Expand description
Store-backed session manager.
Session metadata is stored under namespace ["sessions"], key = session_id.
Messages are accessed through ChatMessageHistory (same store).
Checkpoints are accessed through StoreCheckpointer (same store).
Implementations§
Source§impl SessionManager
impl SessionManager
Sourcepub fn new(store: Arc<dyn Store>) -> Self
pub fn new(store: Arc<dyn Store>) -> Self
Create a new session manager backed by the given store.
Sourcepub async fn create_session(&self) -> Result<String, SynapticError>
pub async fn create_session(&self) -> Result<String, SynapticError>
Create a new session with a unique ID.
Sourcepub async fn list_sessions(&self) -> Result<Vec<SessionInfo>, SynapticError>
pub async fn list_sessions(&self) -> Result<Vec<SessionInfo>, SynapticError>
List all sessions.
Sourcepub async fn get_session(
&self,
id: &str,
) -> Result<Option<SessionInfo>, SynapticError>
pub async fn get_session( &self, id: &str, ) -> Result<Option<SessionInfo>, SynapticError>
Get session info by ID.
Sourcepub async fn delete_session(&self, id: &str) -> Result<(), SynapticError>
pub async fn delete_session(&self, id: &str) -> Result<(), SynapticError>
Delete a session and all its associated data (messages, summaries, checkpoints).
Sourcepub fn memory(&self) -> ChatMessageHistory
pub fn memory(&self) -> ChatMessageHistory
Get a ChatMessageHistory that shares the same store.
Sourcepub fn checkpointer(&self) -> StoreCheckpointer
pub fn checkpointer(&self) -> StoreCheckpointer
Get a StoreCheckpointer that shares the same store.
Auto Trait Implementations§
impl Freeze for SessionManager
impl !RefUnwindSafe for SessionManager
impl Send for SessionManager
impl Sync for SessionManager
impl Unpin for SessionManager
impl UnsafeUnpin for SessionManager
impl !UnwindSafe for SessionManager
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