pub struct SessionStore { /* private fields */ }Expand description
An in-memory session store.
The store remains synchronous for in-process mutation (append), while
explicit save/load methods bridge to async persistence adapters.
Implementations§
Source§impl SessionStore
impl SessionStore
Sourcepub fn create(&self) -> SessionId
pub fn create(&self) -> SessionId
Create a new session with default, unspecified configuration and return its id.
Sourcepub fn create_with_config(
&self,
model: impl Into<String>,
max_turns: usize,
system_message: Option<String>,
) -> SessionId
pub fn create_with_config( &self, model: impl Into<String>, max_turns: usize, system_message: Option<String>, ) -> SessionId
Create a new session with explicit run configuration and return its id.
Sourcepub fn append(&self, id: SessionId, message: AgentMessage) -> RuntimeResult<()>
pub fn append(&self, id: SessionId, message: AgentMessage) -> RuntimeResult<()>
Append a message to a session.
Sourcepub fn messages(&self, id: SessionId) -> RuntimeResult<Vec<AgentMessage>>
pub fn messages(&self, id: SessionId) -> RuntimeResult<Vec<AgentMessage>>
Snapshot a session’s messages.
Sourcepub async fn save(
&self,
adapter: &dyn PersistenceAdapter,
id: SessionId,
) -> RuntimeResult<()>
pub async fn save( &self, adapter: &dyn PersistenceAdapter, id: SessionId, ) -> RuntimeResult<()>
Persist a session through the provided adapter.
Sourcepub async fn load(
adapter: &dyn PersistenceAdapter,
id: SessionId,
) -> RuntimeResult<Option<Session>>
pub async fn load( adapter: &dyn PersistenceAdapter, id: SessionId, ) -> RuntimeResult<Option<Session>>
Load a session from the provided adapter.
Sourcepub async fn list(
adapter: &dyn PersistenceAdapter,
) -> RuntimeResult<Vec<SessionId>>
pub async fn list( adapter: &dyn PersistenceAdapter, ) -> RuntimeResult<Vec<SessionId>>
List all persisted sessions from the provided adapter.
Trait Implementations§
Source§impl Default for SessionStore
impl Default for SessionStore
Source§fn default() -> SessionStore
fn default() -> SessionStore
Returns the “default value” for a type. Read more
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