pub struct MemoryStore { /* private fields */ }Expand description
A ConversationStore kept in memory, for runtime tests.
Implementations§
Trait Implementations§
Source§impl ConversationStore for MemoryStore
impl ConversationStore for MemoryStore
Source§fn mark_seen<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
channel: &'life1 ChannelId,
event_id: &'life2 str,
ttl: Duration,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn mark_seen<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
channel: &'life1 ChannelId,
event_id: &'life2 str,
ttl: Duration,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Records an inbound event id. Returns
false when it was already seen within ttl.Source§fn append<'life0, 'async_trait>(
&'life0 self,
message: NewMessage,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn append<'life0, 'async_trait>(
&'life0 self,
message: NewMessage,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Appends a message to a conversation.
Source§fn recent<'life0, 'life1, 'async_trait>(
&'life0 self,
conversation: &'life1 ConversationKey,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoredMessage>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn recent<'life0, 'life1, 'async_trait>(
&'life0 self,
conversation: &'life1 ConversationKey,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoredMessage>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
The newest
limit messages after the last reset, oldest first.Source§fn reset<'life0, 'life1, 'async_trait>(
&'life0 self,
conversation: &'life1 ConversationKey,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn reset<'life0, 'life1, 'async_trait>(
&'life0 self,
conversation: &'life1 ConversationKey,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Starts a fresh history for the conversation (
/reset). Old messages stay for audit
until retention removes them.Source§fn session<'life0, 'life1, 'async_trait>(
&'life0 self,
conversation: &'life1 ConversationKey,
) -> Pin<Box<dyn Future<Output = Result<Option<(String, String)>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn session<'life0, 'life1, 'async_trait>(
&'life0 self,
conversation: &'life1 ConversationKey,
) -> Pin<Box<dyn Future<Output = Result<Option<(String, String)>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
The native agent session of a conversation:
(backend, session id).Source§fn set_session<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
conversation: &'life1 ConversationKey,
backend: &'life2 str,
session: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn set_session<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
conversation: &'life1 ConversationKey,
backend: &'life2 str,
session: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Remembers the native agent session of a conversation (cleared by
ConversationStore::reset).Source§fn owners<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<(ChannelId, UserId)>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn owners<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<(ChannelId, UserId)>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Accounts of the owner of a personal bot (paired with
ConversationStore::redeem_pairing_code).Source§fn remove_owner<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
channel: &'life1 ChannelId,
user: &'life2 UserId,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn remove_owner<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
channel: &'life1 ChannelId,
user: &'life2 UserId,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Removes an owner account. Returns whether it was one.
Source§fn create_pairing_code<'life0, 'life1, 'async_trait>(
&'life0 self,
code: &'life1 str,
ttl: Duration,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_pairing_code<'life0, 'life1, 'async_trait>(
&'life0 self,
code: &'life1 str,
ttl: Duration,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stores a one-time pairing code, valid for
ttl.Source§fn redeem_pairing_code<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
code: &'life1 str,
channel: &'life2 ChannelId,
user: &'life3 UserId,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn redeem_pairing_code<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
code: &'life1 str,
channel: &'life2 ChannelId,
user: &'life3 UserId,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Source§fn record_run<'life0, 'async_trait>(
&'life0 self,
run: AgentRunRecord,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn record_run<'life0, 'async_trait>(
&'life0 self,
run: AgentRunRecord,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Records an agent run.
Source§fn claim_fire<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
fire_at: Timestamp,
) -> Pin<Box<dyn Future<Output = Result<Fire, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn claim_fire<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
fire_at: Timestamp,
) -> Pin<Box<dyn Future<Output = Result<Fire, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Claims a task firing: records it as
FireState::Sending the first time and returns its
current record, so a firing that was already sent is never sent again.Source§fn set_fire<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
fire_at: Timestamp,
state: FireState,
attempts: u32,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_fire<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
fire_at: Timestamp,
state: FireState,
attempts: u32,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Updates a claimed firing.
Source§fn recent_fires<'life0, 'async_trait>(
&'life0 self,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Fire>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn recent_fires<'life0, 'async_trait>(
&'life0 self,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Fire>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The newest
limit firings, newest first (for okbot doctor and okbot task).Source§fn set_direct_chat<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
channel: &'life1 ChannelId,
user: &'life2 UserId,
conversation: &'life3 ConversationKey,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn set_direct_chat<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
channel: &'life1 ChannelId,
user: &'life2 UserId,
conversation: &'life3 ConversationKey,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Remembers the direct conversation of
user on channel (reminders sent there).Source§fn direct_chat<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
channel: &'life1 ChannelId,
user: &'life2 UserId,
) -> Pin<Box<dyn Future<Output = Result<Option<ConversationKey>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn direct_chat<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
channel: &'life1 ChannelId,
user: &'life2 UserId,
) -> Pin<Box<dyn Future<Output = Result<Option<ConversationKey>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
The latest direct conversation of
user on channel.Source§fn purge_before<'life0, 'async_trait>(
&'life0 self,
before: Timestamp,
) -> Pin<Box<dyn Future<Output = Result<u64, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn purge_before<'life0, 'async_trait>(
&'life0 self,
before: Timestamp,
) -> Pin<Box<dyn Future<Output = Result<u64, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Deletes messages, runs, dedupe marks and finished firings older than
before. Returns rows
removed.Auto Trait Implementations§
impl !Freeze for MemoryStore
impl !RefUnwindSafe for MemoryStore
impl !UnwindSafe for MemoryStore
impl Send for MemoryStore
impl Sync for MemoryStore
impl Unpin for MemoryStore
impl UnsafeUnpin for MemoryStore
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