pub struct PersistenceManager { /* private fields */ }Expand description
Main persistence manager
Implementations§
Source§impl PersistenceManager
impl PersistenceManager
Sourcepub fn new(backend: Arc<dyn PersistenceBackend>) -> Self
pub fn new(backend: Arc<dyn PersistenceBackend>) -> Self
Create a new persistence manager with the given backend
Sourcepub fn with_file_backend(path: impl AsRef<Path>) -> Self
pub fn with_file_backend(path: impl AsRef<Path>) -> Self
Create with file backend
Sourcepub fn with_memory_backend() -> Self
pub fn with_memory_backend() -> Self
Create with memory backend
Sourcepub fn set_checkpoint_config(&mut self, config: CheckpointConfig)
pub fn set_checkpoint_config(&mut self, config: CheckpointConfig)
Set checkpoint configuration
Sourcepub async fn initialize(&self) -> Result<()>
pub async fn initialize(&self) -> Result<()>
Initialize the persistence system
Sourcepub async fn save_agent(&self, state: &AgentState) -> Result<()>
pub async fn save_agent(&self, state: &AgentState) -> Result<()>
Save agent state
Sourcepub async fn load_agent(&self, agent_id: &AgentId) -> Result<Option<AgentState>>
pub async fn load_agent(&self, agent_id: &AgentId) -> Result<Option<AgentState>>
Load agent state
Sourcepub async fn delete_agent(&self, agent_id: &AgentId) -> Result<()>
pub async fn delete_agent(&self, agent_id: &AgentId) -> Result<()>
Delete agent and all associated data
Sourcepub async fn list_agents(&self) -> Result<Vec<AgentId>>
pub async fn list_agents(&self) -> Result<Vec<AgentId>>
List all agents
Sourcepub async fn save_conversation(&self, conversation: &Conversation) -> Result<()>
pub async fn save_conversation(&self, conversation: &Conversation) -> Result<()>
Save conversation
Sourcepub async fn load_conversation(
&self,
conversation_id: &ConversationId,
) -> Result<Option<Conversation>>
pub async fn load_conversation( &self, conversation_id: &ConversationId, ) -> Result<Option<Conversation>>
Load conversation
Sourcepub async fn delete_conversation(
&self,
conversation_id: &ConversationId,
) -> Result<()>
pub async fn delete_conversation( &self, conversation_id: &ConversationId, ) -> Result<()>
Delete conversation
Sourcepub async fn list_conversations(
&self,
agent_id: &AgentId,
) -> Result<Vec<ConversationId>>
pub async fn list_conversations( &self, agent_id: &AgentId, ) -> Result<Vec<ConversationId>>
List conversations for an agent
Sourcepub async fn search_conversations(
&self,
agent_id: &AgentId,
query: &str,
limit: usize,
) -> Result<Vec<ConversationId>>
pub async fn search_conversations( &self, agent_id: &AgentId, query: &str, limit: usize, ) -> Result<Vec<ConversationId>>
Search conversations
Sourcepub async fn add_message(
&self,
conversation_id: &ConversationId,
message: Message,
) -> Result<()>
pub async fn add_message( &self, conversation_id: &ConversationId, message: Message, ) -> Result<()>
Add a message to a conversation
Sourcepub async fn create_checkpoint(
&self,
agent_id: &AgentId,
name: &str,
checkpoint_type: CheckpointType,
) -> Result<CheckpointId>
pub async fn create_checkpoint( &self, agent_id: &AgentId, name: &str, checkpoint_type: CheckpointType, ) -> Result<CheckpointId>
Create a checkpoint
Sourcepub async fn restore_checkpoint(
&self,
checkpoint_id: &CheckpointId,
) -> Result<AgentId>
pub async fn restore_checkpoint( &self, checkpoint_id: &CheckpointId, ) -> Result<AgentId>
Restore from a checkpoint
Sourcepub async fn list_checkpoints(
&self,
agent_id: &AgentId,
) -> Result<Vec<CheckpointId>>
pub async fn list_checkpoints( &self, agent_id: &AgentId, ) -> Result<Vec<CheckpointId>>
List checkpoints for an agent
Sourcepub async fn delete_checkpoint(
&self,
checkpoint_id: &CheckpointId,
) -> Result<()>
pub async fn delete_checkpoint( &self, checkpoint_id: &CheckpointId, ) -> Result<()>
Delete a checkpoint
Sourcepub async fn start_auto_checkpoint(&self, agent_ids: Vec<AgentId>)
pub async fn start_auto_checkpoint(&self, agent_ids: Vec<AgentId>)
Start automatic checkpoint scheduler
Sourcepub async fn stop_auto_checkpoint(&self)
pub async fn stop_auto_checkpoint(&self)
Stop automatic checkpointing
Sourcepub async fn get_stats(&self) -> Result<StorageStats>
pub async fn get_stats(&self) -> Result<StorageStats>
Get storage statistics
Auto Trait Implementations§
impl Freeze for PersistenceManager
impl !RefUnwindSafe for PersistenceManager
impl Send for PersistenceManager
impl Sync for PersistenceManager
impl Unpin for PersistenceManager
impl !UnwindSafe for PersistenceManager
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> 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 more