pub struct NatsBufferedThreadStore<T>{ /* private fields */ }Implementations§
Source§impl<T> NatsBufferedThreadStore<T>
impl<T> NatsBufferedThreadStore<T>
pub async fn connect( inner: Arc<T>, config: NatsBufferedThreadConfig, ) -> Result<NatsBufferedThreadStore<T>, StorageError>
pub async fn shutdown(&self) -> Result<(), StorageError>
pub async fn force_flush_all_pending(&self) -> Result<(), StorageError>
Sourcepub async fn force_flush(&self, thread_id: &str) -> Result<(), StorageError>
pub async fn force_flush(&self, thread_id: &str) -> Result<(), StorageError>
Block until the flusher has drained all pending entries for the given thread.
Trait Implementations§
Source§impl<T> RunStore for NatsBufferedThreadStore<T>
impl<T> RunStore for NatsBufferedThreadStore<T>
Source§fn create_run<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 RunRecord,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
fn create_run<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 RunRecord,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
Create a new run record.
Source§fn load_run<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<RunRecord>, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
fn load_run<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<RunRecord>, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
Load a run record by
run_id.Source§fn latest_run<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<RunRecord>, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
fn latest_run<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<RunRecord>, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
Find the latest run for a thread (by
updated_at).Source§fn list_runs<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 RunQuery,
) -> Pin<Box<dyn Future<Output = Result<RunPage, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
fn list_runs<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 RunQuery,
) -> Pin<Box<dyn Future<Output = Result<RunPage, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
List runs with optional filtering and pagination.
Source§impl<T> ThreadRunStore for NatsBufferedThreadStore<T>
impl<T> ThreadRunStore for NatsBufferedThreadStore<T>
Source§fn checkpoint<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
messages: &'life2 [Message],
run: &'life3 RunRecord,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
fn checkpoint<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
messages: &'life2 [Message],
run: &'life3 RunRecord,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
👎Deprecated since 0.6.0:
use CommitCoordinator (ADR-0038 D7)
Source§fn thread_run_storage_identity(&self) -> Option<String>
fn thread_run_storage_identity(&self) -> Option<String>
Return an identity for the backing thread/run store, when the
implementation can prove it. This is intentionally narrower than a
coordinator transaction scope: it only identifies the thread/run read
and write backend used by mailbox/server code.
Source§fn checkpoint_append<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
messages: &'life2 [Message],
expected_version: Option<u64>,
run: &'life3 RunRecord,
) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn checkpoint_append<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
messages: &'life2 [Message],
expected_version: Option<u64>,
run: &'life3 RunRecord,
) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Append to the committed log and persist
run, guarded by message count.Source§fn load_checkpoint<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<CheckpointSnapshot>, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn load_checkpoint<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<CheckpointSnapshot>, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Read a consistent
CheckpointSnapshot for resume (ADR-0038 C5). Read moreSource§impl<T> ThreadStore for NatsBufferedThreadStore<T>
impl<T> ThreadStore for NatsBufferedThreadStore<T>
Source§fn load_thread<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Thread>, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
fn load_thread<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Thread>, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
Load a thread by ID. Returns
None if not found.Source§fn save_thread<'life0, 'life1, 'async_trait>(
&'life0 self,
thread: &'life1 Thread,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
fn save_thread<'life0, 'life1, 'async_trait>(
&'life0 self,
thread: &'life1 Thread,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
Persist a thread (create or overwrite). Read more
Source§fn save_thread_state<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
state: &'life2 PersistedState,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
fn save_thread_state<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
state: &'life2 PersistedState,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
Persist thread-scoped state for
thread_id (overwrite the prior value). Read moreSource§fn load_thread_state<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<PersistedState>, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
fn load_thread_state<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<PersistedState>, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
Load thread-scoped state for
thread_id, if any. Default None.Source§fn save_thread_validated<'life0, 'life1, 'async_trait>(
&'life0 self,
thread: &'life1 Thread,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
fn save_thread_validated<'life0, 'life1, 'async_trait>(
&'life0 self,
thread: &'life1 Thread,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
Persist a thread after validating parent-child hierarchy invariants. Read more
Source§fn delete_thread<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
fn delete_thread<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
Delete a thread and its associated messages. Read more
Source§fn delete_thread_with_strategy<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
strategy: ChildThreadDeleteStrategy,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
fn delete_thread_with_strategy<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
strategy: ChildThreadDeleteStrategy,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
Delete a thread while managing direct and transitive children. Read more
Source§fn list_threads<'life0, 'async_trait>(
&'life0 self,
offset: usize,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
fn list_threads<'life0, 'async_trait>(
&'life0 self,
offset: usize,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
List thread IDs with pagination.
Source§fn list_threads_query<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 ThreadQuery,
) -> Pin<Box<dyn Future<Output = Result<ThreadPage, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
fn list_threads_query<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 ThreadQuery,
) -> Pin<Box<dyn Future<Output = Result<ThreadPage, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
List thread IDs with first-class filters and page metadata.
fn load_messages<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Message>>, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
fn load_committed_messages<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Message>>, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
Source§fn list_message_records<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
query: &'life2 MessageQuery,
) -> Pin<Box<dyn Future<Output = Result<MessagePage, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
fn list_message_records<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
query: &'life2 MessageQuery,
) -> Pin<Box<dyn Future<Output = Result<MessagePage, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
List thread-owned message records with filtering and page metadata.
Source§fn save_messages<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
messages: &'life2 [Message],
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
fn save_messages<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
messages: &'life2 [Message],
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
Persist messages for a thread (full overwrite).
Source§fn delete_messages<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
fn delete_messages<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
Delete all messages for a thread. Returns
NotFound if the thread does not exist.Source§fn update_thread_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
metadata: ThreadMetadata,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
fn update_thread_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
metadata: ThreadMetadata,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NatsBufferedThreadStore<T>: 'async_trait,
Update only the metadata of an existing thread.
Returns
NotFound if the thread does not exist.Source§fn list_child_threads<'life0, 'life1, 'async_trait>(
&'life0 self,
parent_thread_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Thread>, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn list_child_threads<'life0, 'life1, 'async_trait>(
&'life0 self,
parent_thread_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Thread>, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Load all direct child threads for a given parent thread.
Source§fn validate_thread_hierarchy<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
parent_thread_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn validate_thread_hierarchy<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
parent_thread_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Validate parent-child hierarchy invariants for a thread.
fn load_message_records<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<MessageRecord>>, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Source§fn append_message_records<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
messages: &'life2 [Message],
) -> Pin<Box<dyn Future<Output = Result<Vec<MessageRecord>, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn append_message_records<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
messages: &'life2 [Message],
) -> Pin<Box<dyn Future<Output = Result<Vec<MessageRecord>, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Append messages to a thread’s durable log and return their records.
Source§fn load_message_record<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
message_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<MessageRecord>, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn load_message_record<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
message_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<MessageRecord>, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Load one message record by message ID.
Source§fn load_message_records_range<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
range: MessageSeqRange,
) -> Pin<Box<dyn Future<Output = Result<Vec<MessageRecord>, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn load_message_records_range<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
range: MessageSeqRange,
) -> Pin<Box<dyn Future<Output = Result<Vec<MessageRecord>, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Load message records by inclusive sequence range.
Auto Trait Implementations§
impl<T> !Freeze for NatsBufferedThreadStore<T>
impl<T> !RefUnwindSafe for NatsBufferedThreadStore<T>
impl<T> !UnwindSafe for NatsBufferedThreadStore<T>
impl<T> Send for NatsBufferedThreadStore<T>
impl<T> Sync for NatsBufferedThreadStore<T>
impl<T> Unpin for NatsBufferedThreadStore<T>
impl<T> UnsafeUnpin for NatsBufferedThreadStore<T>
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