pub struct SqliteSessionBackend { /* private fields */ }Expand description
SQLite-backed session store with FTS5 and WAL mode.
Implementations§
Trait Implementations§
Source§impl SessionBackend for SqliteSessionBackend
impl SessionBackend for SqliteSessionBackend
Source§fn load(&self, session_key: &str) -> Vec<ChatMessage>
fn load(&self, session_key: &str) -> Vec<ChatMessage>
Load all messages for a session. Returns empty vec if session doesn’t exist.
Source§fn append(&self, session_key: &str, message: &ChatMessage) -> Result<()>
fn append(&self, session_key: &str, message: &ChatMessage) -> Result<()>
Append a single message to a session.
Source§fn remove_last(&self, session_key: &str) -> Result<bool>
fn remove_last(&self, session_key: &str) -> Result<bool>
Remove the last message from a session. Returns
true if a message was removed.Source§fn list_sessions(&self) -> Vec<String>
fn list_sessions(&self) -> Vec<String>
List all session keys.
Source§fn list_sessions_with_metadata(&self) -> Vec<SessionMetadata>
fn list_sessions_with_metadata(&self) -> Vec<SessionMetadata>
List sessions with metadata.
Source§fn cleanup_stale(&self, ttl_hours: u32) -> Result<usize>
fn cleanup_stale(&self, ttl_hours: u32) -> Result<usize>
Remove sessions that haven’t been active within the given TTL hours.
Source§fn delete_session(&self, session_key: &str) -> Result<bool>
fn delete_session(&self, session_key: &str) -> Result<bool>
Delete all messages for a session. Returns
true if the session existed.Source§fn set_session_name(&self, session_key: &str, name: &str) -> Result<()>
fn set_session_name(&self, session_key: &str, name: &str) -> Result<()>
Set or update the human-readable name for a session.
Source§fn get_session_name(&self, session_key: &str) -> Result<Option<String>>
fn get_session_name(&self, session_key: &str) -> Result<Option<String>>
Get the human-readable name for a session (if set).
Source§fn set_session_state(
&self,
session_key: &str,
state: &str,
turn_id: Option<&str>,
) -> Result<()>
fn set_session_state( &self, session_key: &str, state: &str, turn_id: Option<&str>, ) -> Result<()>
Set the session state (e.g. “idle”, “running”, “error”).
turn_id identifies the current turn (set when running, cleared on idle).Source§fn get_session_state(&self, session_key: &str) -> Result<Option<SessionState>>
fn get_session_state(&self, session_key: &str) -> Result<Option<SessionState>>
Get the current session state. Returns
None if the backend doesn’t track state.Source§fn list_running_sessions(&self) -> Vec<SessionMetadata>
fn list_running_sessions(&self) -> Vec<SessionMetadata>
List sessions currently in “running” state.
Source§fn list_stuck_sessions(&self, threshold_secs: u64) -> Vec<SessionMetadata>
fn list_stuck_sessions(&self, threshold_secs: u64) -> Vec<SessionMetadata>
List sessions stuck in “running” state longer than
threshold_secs.Source§fn search(&self, query: &SessionQuery) -> Vec<SessionMetadata>
fn search(&self, query: &SessionQuery) -> Vec<SessionMetadata>
Search sessions by keyword. Default returns empty (backends with FTS override).
Auto Trait Implementations§
impl !Freeze for SqliteSessionBackend
impl !RefUnwindSafe for SqliteSessionBackend
impl Send for SqliteSessionBackend
impl Sync for SqliteSessionBackend
impl Unpin for SqliteSessionBackend
impl UnsafeUnpin for SqliteSessionBackend
impl !UnwindSafe for SqliteSessionBackend
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more