Skip to main content

SessionStore

Trait SessionStore 

Source
pub trait SessionStore: Send + Sync {
    // Required methods
    fn create<'life0, 'life1, 'async_trait>(
        &'life0 self,
        project: &'life1 str,
        messages: Vec<Message>,
    ) -> Pin<Box<dyn Future<Output = Result<SessionRecord>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn fork<'life0, 'life1, 'async_trait>(
        &'life0 self,
        project: &'life1 str,
        parent: SessionId,
        messages: Vec<Message>,
        turns: u32,
    ) -> Pin<Box<dyn Future<Output = Result<SessionRecord>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update<'life0, 'async_trait>(
        &'life0 self,
        id: SessionId,
        messages: Vec<Message>,
        turns: u32,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn rename<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: SessionId,
        title: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_by_project<'life0, 'life1, 'async_trait>(
        &'life0 self,
        project: &'life1 str,
        limit: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<SessionRecord>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get<'life0, 'async_trait>(
        &'life0 self,
        id: SessionId,
    ) -> Pin<Box<dyn Future<Output = Result<Option<SessionRecord>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete<'life0, 'async_trait>(
        &'life0 self,
        id: SessionId,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn latest<'life0, 'life1, 'async_trait>(
        &'life0 self,
        project: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<SessionRecord>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn search<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query: &'life1 str,
        limit: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<SearchHit>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn find_by_id_prefix<'life0, 'life1, 'async_trait>(
        &'life0 self,
        prefix: &'life1 str,
        limit: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<SessionRecord>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Async session store.

Required Methods§

Source

fn create<'life0, 'life1, 'async_trait>( &'life0 self, project: &'life1 str, messages: Vec<Message>, ) -> Pin<Box<dyn Future<Output = Result<SessionRecord>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a new session row and return the hydrated record.

Source

fn fork<'life0, 'life1, 'async_trait>( &'life0 self, project: &'life1 str, parent: SessionId, messages: Vec<Message>, turns: u32, ) -> Pin<Box<dyn Future<Output = Result<SessionRecord>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fork an existing session: create a child row carrying a copy of messages with parent_id set to parent and a turns carried over from the parent (Phase Z).

Source

fn update<'life0, 'async_trait>( &'life0 self, id: SessionId, messages: Vec<Message>, turns: u32, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Replace the messages of an existing session and bump turns + updated_at.

Source

fn rename<'life0, 'life1, 'async_trait>( &'life0 self, id: SessionId, title: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set an explicit, user-chosen title for a session, overriding the auto-derived one (Phase RR — /rename). Leaves messages/turns untouched.

Source

fn list_by_project<'life0, 'life1, 'async_trait>( &'life0 self, project: &'life1 str, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<SessionRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Most recent sessions for project first.

Source

fn get<'life0, 'async_trait>( &'life0 self, id: SessionId, ) -> Pin<Box<dyn Future<Output = Result<Option<SessionRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fetch by id.

Source

fn delete<'life0, 'async_trait>( &'life0 self, id: SessionId, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Remove a session.

Source

fn latest<'life0, 'life1, 'async_trait>( &'life0 self, project: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<SessionRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Most recent session for project, if any.

Source

fn search<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 str, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<SearchHit>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Substring search across every session’s message bodies and titles. Case-insensitive. Most recently updated hits first (Phase L).

Source

fn find_by_id_prefix<'life0, 'life1, 'async_trait>( &'life0 self, prefix: &'life1 str, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<SessionRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Resolve a UUID prefix to the matching SessionRecord(s). Empty vec when no match, multi-element when the prefix is ambiguous. Used by /load (Phase L).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§