pub struct ConversationStore { /* private fields */ }Expand description
Conversation storage operations.
Implementations§
Source§impl ConversationStore
impl ConversationStore
Sourcepub async fn create(&self) -> StoreResult<ConversationData>
pub async fn create(&self) -> StoreResult<ConversationData>
Sourcepub async fn get_or_create(
&self,
conversation_id: &str,
) -> StoreResult<ConversationData>
pub async fn get_or_create( &self, conversation_id: &str, ) -> StoreResult<ConversationData>
Gets a conversation or creates it if it doesn’t exist.
§Errors
Returns error if database query fails.
Sourcepub async fn get(&self, conversation_id: &str) -> StoreResult<ConversationData>
pub async fn get(&self, conversation_id: &str) -> StoreResult<ConversationData>
Sourcepub async fn rehydrate(
&self,
conversation_id: &str,
) -> StoreResult<Vec<InOutItem>>
pub async fn rehydrate( &self, conversation_id: &str, ) -> StoreResult<Vec<InOutItem>>
Rehydrates a conversation with all its items.
§Errors
Returns an error if a stored item is missing its sequence number or if the database query fails.
Sourcepub async fn rehydrate_snapshot(
&self,
conversation_id: &str,
) -> StoreResult<ConversationSnapshot>
pub async fn rehydrate_snapshot( &self, conversation_id: &str, ) -> StoreResult<ConversationSnapshot>
Rehydrates a conversation with its items and storage version.
§Errors
Returns an error if a stored item is missing its sequence number or if the database query fails.
Sourcepub async fn persist(
&self,
conversation_id: &str,
response_id: &str,
previous_response_id: Option<&str>,
new_items: Vec<InOutItem>,
metadata: &ResponseMetadata,
) -> StoreResult<()>
pub async fn persist( &self, conversation_id: &str, response_id: &str, previous_response_id: Option<&str>, new_items: Vec<InOutItem>, metadata: &ResponseMetadata, ) -> StoreResult<()>
Persists conversation turn with new items and response metadata.
Creates items in the conversation and stores the associated response record.
§Errors
Returns StorageError if conversation not found or database operation fails.
Sourcepub async fn persist_if_version(
&self,
conversation_id: &str,
expected_version: ConversationVersion,
response_id: &str,
previous_response_id: Option<&str>,
new_items: Vec<InOutItem>,
metadata: &ResponseMetadata,
) -> StoreResult<()>
pub async fn persist_if_version( &self, conversation_id: &str, expected_version: ConversationVersion, response_id: &str, previous_response_id: Option<&str>, new_items: Vec<InOutItem>, metadata: &ResponseMetadata, ) -> StoreResult<()>
Persists a conversation turn only if its stored version still matches.
§Errors
Returns StorageError if the conversation changed, was not found, or a database operation fails.
Trait Implementations§
Source§impl Clone for ConversationStore
impl Clone for ConversationStore
Source§fn clone(&self) -> ConversationStore
fn clone(&self) -> ConversationStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ConversationStore
impl !UnwindSafe for ConversationStore
impl Freeze for ConversationStore
impl Send for ConversationStore
impl Sync for ConversationStore
impl Unpin for ConversationStore
impl UnsafeUnpin for ConversationStore
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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