Skip to main content

Module store

Module store 

Source
Expand description

Session persistence layer

Provides pluggable session storage via the SessionStore trait.

§Default Implementation

FileSessionStore stores each session as a JSON file:

  • Session metadata (id, name, timestamps)
  • Configuration (system prompt, policies)
  • Conversation history (messages)
  • Context usage statistics

§Custom Backends

Implement SessionStore trait for custom backends (Redis, PostgreSQL, etc.):

use a3s_code::store::{SessionStore, SessionData};

struct RedisStore { /* ... */ }

#[async_trait::async_trait]
impl SessionStore for RedisStore {
    async fn save(&self, session: &SessionData) -> Result<()> { /* ... */ }
    async fn load(&self, id: &str) -> Result<Option<SessionData>> { /* ... */ }
    async fn delete(&self, id: &str) -> Result<()> { /* ... */ }
    async fn list(&self) -> Result<Vec<String>> { /* ... */ }
    async fn exists(&self, id: &str) -> Result<bool> { /* ... */ }
}

Structs§

FileSessionStore
File-based session store
LlmConfigData
Serializable LLM configuration
MemorySessionStore
In-memory session store for testing
SessionData
Serializable session data for persistence

Traits§

SessionStore
Session storage trait