pub struct PersistentStateStore { /* private fields */ }Implementations§
Source§impl PersistentStateStore
impl PersistentStateStore
pub fn new( dir: impl AsRef<Path>, conversation_store: PersistentConversationStore, session_store: Arc<Mutex<SessionStore>>, ) -> Self
pub fn has_pending_choices(&self, thread_id: &ThreadId<str>) -> bool
Sourcepub fn has_pending_choices_for_session(
&self,
session_id: &ThreadId<str>,
) -> bool
pub fn has_pending_choices_for_session( &self, session_id: &ThreadId<str>, ) -> bool
Whether any thread in the session rooted at session_id has a pending
user choice. The exact-thread query above remains available for routing
choice responses to the thread that requested them.
pub fn pending_choice( &self, thread_id: &ThreadId<str>, choice_id: &ChoiceId<str>, ) -> Option<UserChoice>
pub async fn clear_pending_choices( &self, thread_id: &ThreadId<str>, ) -> Result<(), MemoryError>
Sourcepub async fn clear_pending_choices_for_session(
&self,
session_id: &ThreadId<str>,
) -> Result<(), MemoryError>
pub async fn clear_pending_choices_for_session( &self, session_id: &ThreadId<str>, ) -> Result<(), MemoryError>
Clear pending choices from the root and every descendant, including closed and compaction threads that are not shown in the session UI.
Trait Implementations§
Source§impl Clone for PersistentStateStore
impl Clone for PersistentStateStore
Source§impl StateStore for PersistentStateStore
impl StateStore for PersistentStateStore
type Error = MemoryError
Source§fn get_processed_ids<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<HashSet<String>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_processed_ids<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<HashSet<String>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Durably deduplicated message IDs for this thread. Only inputs that are
not naturally idempotent are tracked (user text and subscription
events); tool results are deduplicated against history itself.
fn add_processed_message_ids<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
message_ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
root_thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
root_thread_id: &'life1 ThreadId<str>,
metadata: Value,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_active_subscriptions<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ToolCallId>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_active_subscriptions<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ToolCallId>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Return the list of active subscription tool_call_ids for a specific thread.
Source§fn add_active_subscription<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
tool_call_id: &'life2 ToolCallId<str>,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn add_active_subscription<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
tool_call_id: &'life2 ToolCallId<str>,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Record a new active subscription (tool_call_id) for a specific thread.
Source§fn remove_active_subscription<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
tool_call_id: &'life2 ToolCallId<str>,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn remove_active_subscription<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
tool_call_id: &'life2 ToolCallId<str>,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Remove an active subscription (tool_call_id) from a specific thread.
Source§fn add_pending_user_choice<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
choice: UserChoice,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn add_pending_user_choice<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
choice: UserChoice,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Add or replace a pending user choice for one thread.
Source§fn remove_pending_user_choice<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
choice_id: &'life2 ChoiceId<str>,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn remove_pending_user_choice<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
choice_id: &'life2 ChoiceId<str>,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Remove a pending user choice after it is answered or interrupted.
Source§fn get_pending_user_choices<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<UserChoice>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_pending_user_choices<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<UserChoice>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List choices awaiting a response for one thread.
Source§fn is_thread_stopped<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<bool, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn is_thread_stopped<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<bool, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Whether an existing thread has been explicitly stopped. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for PersistentStateStore
impl !UnwindSafe for PersistentStateStore
impl Freeze for PersistentStateStore
impl Send for PersistentStateStore
impl Sync for PersistentStateStore
impl Unpin for PersistentStateStore
impl UnsafeUnpin for PersistentStateStore
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