Skip to main content

MessageStore

Trait MessageStore 

Source
pub trait MessageStore: StorageBackend {
Show 13 methods // Required methods fn create_thread<'life0, 'async_trait>( &'life0 self, thread: Thread, ) -> Pin<Box<dyn Future<Output = Result<ThreadId>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_thread<'life0, 'life1, 'async_trait>( &'life0 self, thread_id: &'life1 ThreadId, ) -> Pin<Box<dyn Future<Output = Result<Option<Thread>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn update_thread<'life0, 'async_trait>( &'life0 self, thread: Thread, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn delete_thread<'life0, 'life1, 'async_trait>( &'life0 self, thread_id: &'life1 ThreadId, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn list_threads<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, tenant_id: &'life1 TenantId, user_id: &'life2 UserId, limit: usize, offset: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<Thread>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn create_message<'life0, 'async_trait>( &'life0 self, message: Message, ) -> Pin<Box<dyn Future<Output = Result<MessageId>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_message<'life0, 'life1, 'async_trait>( &'life0 self, message_id: &'life1 MessageId, ) -> Pin<Box<dyn Future<Output = Result<Option<Message>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn update_message<'life0, 'async_trait>( &'life0 self, message: Message, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn delete_message<'life0, 'life1, 'async_trait>( &'life0 self, message_id: &'life1 MessageId, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn list_messages<'life0, 'life1, 'async_trait>( &'life0 self, thread_id: &'life1 ThreadId, include_deleted: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_messages_by_execution<'life0, 'life1, 'async_trait>( &'life0 self, execution_id: &'life1 ExecutionId, ) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; // Provided methods fn get_or_create_thread<'life0, 'async_trait>( &'life0 self, tenant_id: TenantId, user_id: UserId, ) -> Pin<Box<dyn Future<Output = Result<Thread>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn count_messages<'life0, 'life1, 'async_trait>( &'life0 self, thread_id: &'life1 ThreadId, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... }
}
Expand description

MessageStore trait - thread/message persistence

This is the core persistence trait for user-facing message storage. Unlike EventStore (immutable audit log), MessageStore supports:

  • Soft delete (GDPR compliance)
  • Message editing (optional)
  • Thread management

Required Methods§

Source

fn create_thread<'life0, 'async_trait>( &'life0 self, thread: Thread, ) -> Pin<Box<dyn Future<Output = Result<ThreadId>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create a new thread

Source

fn get_thread<'life0, 'life1, 'async_trait>( &'life0 self, thread_id: &'life1 ThreadId, ) -> Pin<Box<dyn Future<Output = Result<Option<Thread>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a thread by ID

Source

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

Update thread (title, etc.)

Source

fn delete_thread<'life0, 'life1, 'async_trait>( &'life0 self, thread_id: &'life1 ThreadId, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Soft-delete a thread (sets deleted_at)

Source

fn list_threads<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, tenant_id: &'life1 TenantId, user_id: &'life2 UserId, limit: usize, offset: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<Thread>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

List threads for a user

Source

fn create_message<'life0, 'async_trait>( &'life0 self, message: Message, ) -> Pin<Box<dyn Future<Output = Result<MessageId>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create a new message in a thread

Source

fn get_message<'life0, 'life1, 'async_trait>( &'life0 self, message_id: &'life1 MessageId, ) -> Pin<Box<dyn Future<Output = Result<Option<Message>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a message by ID

Source

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

Update a message (content, metadata)

Source

fn delete_message<'life0, 'life1, 'async_trait>( &'life0 self, message_id: &'life1 MessageId, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Soft-delete a message

Source

fn list_messages<'life0, 'life1, 'async_trait>( &'life0 self, thread_id: &'life1 ThreadId, include_deleted: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get all messages in a thread (ordered by created_at)

Source

fn get_messages_by_execution<'life0, 'life1, 'async_trait>( &'life0 self, execution_id: &'life1 ExecutionId, ) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get messages by execution ID

Provided Methods§

Source

fn get_or_create_thread<'life0, 'async_trait>( &'life0 self, tenant_id: TenantId, user_id: UserId, ) -> Pin<Box<dyn Future<Output = Result<Thread>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get or create a thread (implicit thread creation)

Source

fn count_messages<'life0, 'life1, 'async_trait>( &'life0 self, thread_id: &'life1 ThreadId, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Count messages in a thread

Implementors§