pub trait SessionStore: Send + Sync {
// Required methods
fn create(&self, title: Option<String>) -> Result<Session, Error>;
fn get(&self, id: Uuid) -> Result<Option<Session>, Error>;
fn list(&self) -> Result<Vec<Session>, Error>;
fn delete(&self, id: Uuid) -> Result<bool, Error>;
fn add_message(
&self,
id: Uuid,
message: SessionMessage,
) -> Result<(), Error>;
// Provided methods
fn create_with_user(
&self,
title: Option<String>,
user_id: &str,
tenant_id: &str,
) -> Result<Session, Error> { ... }
fn list_for_tenant(&self, tenant_id: &str) -> Result<Vec<Session>, Error> { ... }
}Expand description
Trait for session persistence.
Required Methods§
Sourcefn create(&self, title: Option<String>) -> Result<Session, Error>
fn create(&self, title: Option<String>) -> Result<Session, Error>
Create a new session with an optional title.
Sourcefn get(&self, id: Uuid) -> Result<Option<Session>, Error>
fn get(&self, id: Uuid) -> Result<Option<Session>, Error>
Get a session by ID. Returns None if not found.
Sourcefn delete(&self, id: Uuid) -> Result<bool, Error>
fn delete(&self, id: Uuid) -> Result<bool, Error>
Delete a session. Returns true if found and deleted.
Sourcefn add_message(&self, id: Uuid, message: SessionMessage) -> Result<(), Error>
fn add_message(&self, id: Uuid, message: SessionMessage) -> Result<(), Error>
Append a message to an existing session.