pub struct SessionStateIndex<'a> { /* private fields */ }Expand description
Session State Index for real-time session context
Provides < 10ms latency for interactive use, session isolation via namespaces, and TTL-based cleanup.
Implementations§
Source§impl<'a> SessionStateIndex<'a>
impl<'a> SessionStateIndex<'a>
Sourcepub fn new(db: &'a AgenticDB, session_id: &str, ttl_seconds: i64) -> Self
pub fn new(db: &'a AgenticDB, session_id: &str, ttl_seconds: i64) -> Self
Create a new session state index
Sourcepub fn add_turn(
&self,
turn_number: usize,
role: &str,
content: &str,
) -> Result<String>
pub fn add_turn( &self, turn_number: usize, role: &str, content: &str, ) -> Result<String>
Add a turn to the session
Sourcepub fn find_relevant_turns(
&self,
query: &str,
k: usize,
) -> Result<Vec<SessionTurn>>
pub fn find_relevant_turns( &self, query: &str, k: usize, ) -> Result<Vec<SessionTurn>>
Find relevant past turns based on current context
Sourcepub fn get_session_context(&self) -> Result<Vec<SessionTurn>>
pub fn get_session_context(&self) -> Result<Vec<SessionTurn>>
Get full session context (all turns in order)
Sourcepub fn cleanup_expired(&self) -> Result<usize>
pub fn cleanup_expired(&self) -> Result<usize>
Clean up expired turns
Auto Trait Implementations§
impl<'a> Freeze for SessionStateIndex<'a>
impl<'a> !RefUnwindSafe for SessionStateIndex<'a>
impl<'a> Send for SessionStateIndex<'a>
impl<'a> Sync for SessionStateIndex<'a>
impl<'a> Unpin for SessionStateIndex<'a>
impl<'a> !UnwindSafe for SessionStateIndex<'a>
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> 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