pub struct MemoryManager {
pub hot_tier: Arc<dyn Memory>,
pub cold_tier: Arc<dyn Memory>,
}Expand description
Combined memory manager for tiered storage
Fields§
§hot_tier: Arc<dyn Memory>Hot Storage Layer (e.g. In-memory or fast local cache)
cold_tier: Arc<dyn Memory>Cold Storage Layer (e.g. SQLite, Vector DB)
Implementations§
Source§impl MemoryManager
impl MemoryManager
Sourcepub fn new(hot_tier: Arc<dyn Memory>, cold_tier: Arc<dyn Memory>) -> Self
pub fn new(hot_tier: Arc<dyn Memory>, cold_tier: Arc<dyn Memory>) -> Self
Create a new MemoryManager with specific backends
Sourcepub async fn store(
&self,
user_id: &str,
agent_id: Option<&str>,
message: Message,
) -> Result<()>
pub async fn store( &self, user_id: &str, agent_id: Option<&str>, message: Message, ) -> Result<()>
Tiered Storage Store Stores in Hot Tier, then auto-archives to Cold Tier if capacity exceeded
Sourcepub async fn retrieve_unified(
&self,
user_id: &str,
agent_id: Option<&str>,
limit: usize,
) -> Vec<Message>
pub async fn retrieve_unified( &self, user_id: &str, agent_id: Option<&str>, limit: usize, ) -> Vec<Message>
Unified Retrieve Fetches from Hot + Cold seamlessly
Trait Implementations§
Source§impl Memory for MemoryManager
impl Memory for MemoryManager
Source§fn store<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
message: Message,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn store<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
message: Message,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Store a message
Source§fn retrieve<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Vec<Message>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn retrieve<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Vec<Message>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Retrieve recent messages
Source§fn search<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
query: &'life3 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Document>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn search<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
query: &'life3 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Document>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Search the memory for relevant content
Source§fn store_knowledge<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
title: &'life3 str,
content: &'life4 str,
collection: &'life5 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
fn store_knowledge<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
title: &'life3 str,
content: &'life4 str,
collection: &'life5 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
Store a specific piece of knowledge (not just a message)
Source§fn clear<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn clear<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Clear memory for a user
Source§fn undo<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Option<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn undo<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Option<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Undo last message
Source§fn store_session<'life0, 'async_trait>(
&'life0 self,
session: AgentSession,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn store_session<'life0, 'async_trait>(
&'life0 self,
session: AgentSession,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Store an agent session state
Source§fn retrieve_session<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AgentSession>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn retrieve_session<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AgentSession>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieve an agent session state
Source§fn fetch_document<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
path: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Document>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn fetch_document<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
path: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Document>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Fetch a full document by path
Source§fn store_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
messages: Vec<Message>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn store_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
messages: Vec<Message>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Store multiple messages efficiently
Source§fn update_summary<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
collection: &'life1 str,
path: &'life2 str,
summary: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn update_summary<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
collection: &'life1 str,
path: &'life2 str,
summary: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Update summary for a piece of knowledge
Source§fn link_scheduler(&self, _scheduler: Weak<Scheduler>)
fn link_scheduler(&self, _scheduler: Weak<Scheduler>)
Link a scheduler for background tasks
Auto Trait Implementations§
impl Freeze for MemoryManager
impl !RefUnwindSafe for MemoryManager
impl Send for MemoryManager
impl Sync for MemoryManager
impl Unpin for MemoryManager
impl !UnwindSafe for MemoryManager
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
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request