pub struct SessionStore { /* private fields */ }Expand description
Session index: session_id → [calls], bounded LRU (both in total sessions
and calls per session). Thread-safe, designed to be shared via
init_session_store. Not persisted.
Implementations§
Source§impl SessionStore
impl SessionStore
Sourcepub fn with_capacity(max_sessions: usize, max_calls_per_session: usize) -> Self
pub fn with_capacity(max_sessions: usize, max_calls_per_session: usize) -> Self
A store with explicit bounds. Panics if either bound is zero.
Sourcepub fn append(
&self,
session_id: &str,
call_id: Option<&str>,
source: SessionSource,
) -> SessionCall
pub fn append( &self, session_id: &str, call_id: Option<&str>, source: SessionSource, ) -> SessionCall
Record a call in the session. Returns the index entry for the call.
Called from the generate_text / stream_text entry points (before
the call is dispatched), so failures are still part of the session.
call_id:调用方已有(RFC-0023 层 A 生成)则复用,保证 session/recording/
trace 三系统同 ID;None 时内部自生成。
Sourcepub fn session_calls(&self, session_id: &str) -> Vec<SessionCall>
pub fn session_calls(&self, session_id: &str) -> Vec<SessionCall>
All calls of a session, ordered by step. Empty if unknown.
Sourcepub fn list_sessions(&self) -> Vec<SessionView>
pub fn list_sessions(&self) -> Vec<SessionView>
All known sessions (unordered), each with its calls.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SessionStore
impl RefUnwindSafe for SessionStore
impl Send for SessionStore
impl Sync for SessionStore
impl Unpin for SessionStore
impl UnsafeUnpin for SessionStore
impl UnwindSafe for SessionStore
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