Skip to main content

MemoryService

Trait MemoryService 

Source
pub trait MemoryService: Send + Sync {
    // Required methods
    fn add_session_to_memory<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session: &'life1 dyn Session,
    ) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn search_memory<'life0, 'async_trait>(
        &'life0 self,
        req: SearchRequest,
    ) -> Pin<Box<dyn Future<Output = Result<SearchResponse, MemoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn as_event_adder(&self) -> Option<&dyn EventAdder> { ... }
}
Expand description

The memory service.

The service ingests sessions into memory so that it can be used for user queries across user-scoped sessions.

Required Methods§

Source

fn add_session_to_memory<'life0, 'life1, 'async_trait>( &'life0 self, session: &'life1 dyn Session, ) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Adds a session to the memory service.

A session can be added multiple times during its lifetime.

Source

fn search_memory<'life0, 'async_trait>( &'life0 self, req: SearchRequest, ) -> Pin<Box<dyn Future<Output = Result<SearchResponse, MemoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns memory entries relevant to the given query. Empty slice is returned if there are no matches.

Provided Methods§

Source

fn as_event_adder(&self) -> Option<&dyn EventAdder>

The service’s EventAdder, when it can ingest an incremental delta of events; None by default.

A type that wraps a service forwards this method itself, or its wrapped adder is not reachable through add_events_to_memory.

EXPERIMENTAL: its API and behavior may change or be removed later.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§