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>>, ) -> PersistentStateStore
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: &ToolCallId<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§fn clone(&self) -> PersistentStateStore
fn clone(&self) -> PersistentStateStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§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
'life0: 'async_trait,
'life1: 'async_trait,
PersistentStateStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
PersistentStateStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
PersistentStateStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
PersistentStateStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
PersistentStateStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
PersistentStateStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
PersistentStateStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
PersistentStateStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
PersistentStateStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
PersistentStateStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
PersistentStateStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
PersistentStateStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
PersistentStateStore: '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 ToolCallId<str>,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
PersistentStateStore: 'async_trait,
fn remove_pending_user_choice<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
choice_id: &'life2 ToolCallId<str>,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
PersistentStateStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
PersistentStateStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
PersistentStateStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
PersistentStateStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
PersistentStateStore: '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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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