pub struct PostgresConversationStore { /* private fields */ }Expand description
PostgreSQL-backed append-only conversation and semantic-memory store.
Implementations§
Source§impl PostgresConversationStore
impl PostgresConversationStore
Sourcepub async fn ensure_schema(&self) -> Result<(), PostgresConversationStoreError>
pub async fn ensure_schema(&self) -> Result<(), PostgresConversationStoreError>
Explicitly creates conversation, transcript, and semantic-memory tables.
Runtime operations never perform hidden migrations.
§Errors
Propagates PostgreSQL DDL failures.
Sourcepub async fn ensure_semantic_memory_vector_schema(
&self,
dimensions: NonZeroU32,
) -> Result<(), PostgresConversationStoreError>
pub async fn ensure_semantic_memory_vector_schema( &self, dimensions: NonZeroU32, ) -> Result<(), PostgresConversationStoreError>
Adds a nullable pgvector column and cosine HNSW index for semantic memory.
Call this explicitly after Self::ensure_schema and before enabling
a vector-configured store in production.
§Errors
Propagates extension and DDL failures.
Source§impl PostgresConversationStore
impl PostgresConversationStore
Sourcepub async fn connect(
connection: &str,
table: &str,
) -> Result<Self, PostgresConversationStoreError>
pub async fn connect( connection: &str, table: &str, ) -> Result<Self, PostgresConversationStoreError>
Connects without creating or changing schema.
§Errors
Rejects unsafe table identifiers and propagates connection failures.
Sourcepub fn with_semantic_memory_embedder(
self,
embedder: Arc<dyn EmbeddingModel>,
) -> Self
pub fn with_semantic_memory_embedder( self, embedder: Arc<dyn EmbeddingModel>, ) -> Self
Enables vector semantic-memory writes and searches for scoped operations.
Trait Implementations§
Source§impl CheckpointStore for PostgresConversationStore
impl CheckpointStore for PostgresConversationStore
Source§fn load(&self, id: CheckpointId) -> Result<Checkpoint, CheckpointError>
fn load(&self, id: CheckpointId) -> Result<Checkpoint, CheckpointError>
Loads the latest checkpoint revision. Read more
Source§fn compare_and_swap(
&self,
checkpoint: &Checkpoint,
expected_revision: Option<u64>,
) -> Result<(), CheckpointError>
fn compare_and_swap( &self, checkpoint: &Checkpoint, expected_revision: Option<u64>, ) -> Result<(), CheckpointError>
Creates or atomically replaces a checkpoint. Read more
Source§impl Clone for PostgresConversationStore
impl Clone for PostgresConversationStore
Source§fn clone(&self) -> PostgresConversationStore
fn clone(&self) -> PostgresConversationStore
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 ConversationStore for PostgresConversationStore
impl ConversationStore for PostgresConversationStore
Source§fn create(
&self,
conversation_id: ConversationId,
namespace: MemoryNamespace,
) -> ConversationStoreFuture<'_, Result<ConversationCreateOutcome, ConversationStoreError>>
fn create( &self, conversation_id: ConversationId, namespace: MemoryNamespace, ) -> ConversationStoreFuture<'_, Result<ConversationCreateOutcome, ConversationStoreError>>
Idempotently creates one empty conversation.
Source§fn load_view(
&self,
conversation_id: ConversationId,
namespace: MemoryNamespace,
window: ConversationWindow,
summary_batch: ConversationSummaryBatch,
) -> ConversationStoreFuture<'_, Result<ConversationView, ConversationStoreError>>
fn load_view( &self, conversation_id: ConversationId, namespace: MemoryNamespace, window: ConversationWindow, summary_batch: ConversationSummaryBatch, ) -> ConversationStoreFuture<'_, Result<ConversationView, ConversationStoreError>>
Loads a bounded view without deleting or rewriting transcript entries.
Source§fn list_transcript(
&self,
conversation_id: ConversationId,
namespace: MemoryNamespace,
after: Option<ConversationSequence>,
limit: ConversationWindow,
) -> ConversationStoreFuture<'_, Result<Vec<ConversationTranscriptEntry>, ConversationStoreError>>
fn list_transcript( &self, conversation_id: ConversationId, namespace: MemoryNamespace, after: Option<ConversationSequence>, limit: ConversationWindow, ) -> ConversationStoreFuture<'_, Result<Vec<ConversationTranscriptEntry>, ConversationStoreError>>
Lists immutable transcript entries strictly after an optional sequence.
Source§fn append(
&self,
namespace: MemoryNamespace,
command: ConversationAppend,
) -> ConversationStoreFuture<'_, Result<ConversationVersion, ConversationStoreError>>
fn append( &self, namespace: MemoryNamespace, command: ConversationAppend, ) -> ConversationStoreFuture<'_, Result<ConversationVersion, ConversationStoreError>>
Atomically appends canonical messages under the expected version.
Source§fn commit_summary(
&self,
namespace: MemoryNamespace,
command: ConversationSummaryCommit,
) -> ConversationStoreFuture<'_, Result<ConversationSummary, ConversationStoreError>>
fn commit_summary( &self, namespace: MemoryNamespace, command: ConversationSummaryCommit, ) -> ConversationStoreFuture<'_, Result<ConversationSummary, ConversationStoreError>>
Monotonically replaces the lossy summary under the expected transcript version.
Source§fn upsert_memory(
&self,
command: SemanticMemoryUpsert,
) -> ConversationStoreFuture<'_, Result<SemanticMemory, ConversationStoreError>>
fn upsert_memory( &self, command: SemanticMemoryUpsert, ) -> ConversationStoreFuture<'_, Result<SemanticMemory, ConversationStoreError>>
Creates or compare-and-swaps one explicitly curated semantic memory.
Source§fn search_memory(
&self,
query: SemanticMemoryQuery,
) -> ConversationStoreFuture<'_, Result<Vec<SemanticMemory>, ConversationStoreError>>
fn search_memory( &self, query: SemanticMemoryQuery, ) -> ConversationStoreFuture<'_, Result<Vec<SemanticMemory>, ConversationStoreError>>
Searches semantic memory without reading transcript or journal storage.
Source§fn upsert_memory_scoped(
&self,
command: SemanticMemoryUpsert,
context: RetrievalContext,
) -> ConversationStoreFuture<'_, Result<SemanticMemoryUpsertOutcome, ConversationStoreError>>
fn upsert_memory_scoped( &self, command: SemanticMemoryUpsert, context: RetrievalContext, ) -> ConversationStoreFuture<'_, Result<SemanticMemoryUpsertOutcome, ConversationStoreError>>
Writes memory under an explicit cancellation/deadline scope. Read more
Source§fn search_memory_scoped(
&self,
query: SemanticMemoryQuery,
context: RetrievalContext,
) -> ConversationStoreFuture<'_, Result<SemanticMemorySearchOutcome, ConversationStoreError>>
fn search_memory_scoped( &self, query: SemanticMemoryQuery, context: RetrievalContext, ) -> ConversationStoreFuture<'_, Result<SemanticMemorySearchOutcome, ConversationStoreError>>
Searches memory under an explicit cancellation/deadline scope. Read more
Source§impl Debug for PostgresConversationStore
impl Debug for PostgresConversationStore
Source§impl DurableConversationStore for PostgresConversationStore
impl DurableConversationStore for PostgresConversationStore
Source§fn commit_durable_turn(
&self,
command: DurableConversationCommit,
) -> ConversationStoreFuture<'_, Result<ConversationVersion, ConversationStoreError>>
fn commit_durable_turn( &self, command: DurableConversationCommit, ) -> ConversationStoreFuture<'_, Result<ConversationVersion, ConversationStoreError>>
Atomically appends a transcript turn and advances its checkpoint.
Source§impl EffectStore for PostgresConversationStore
impl EffectStore for PostgresConversationStore
Source§fn load(
&self,
id: EffectId,
) -> Result<Option<EffectRecord>, EffectExecutorError>
fn load( &self, id: EffectId, ) -> Result<Option<EffectRecord>, EffectExecutorError>
Loads a record by effect identity. Read more
Source§fn find_by_idempotency(
&self,
capability_id: CapabilityId,
key: &str,
) -> Result<Option<EffectRecord>, EffectExecutorError>
fn find_by_idempotency( &self, capability_id: CapabilityId, key: &str, ) -> Result<Option<EffectRecord>, EffectExecutorError>
Resolves a logical effect by capability-scoped idempotency key. Read more
Source§fn compare_and_swap(
&self,
record: &EffectRecord,
expected_revision: Option<u64>,
) -> Result<(), EffectExecutorError>
fn compare_and_swap( &self, record: &EffectRecord, expected_revision: Option<u64>, ) -> Result<(), EffectExecutorError>
Creates or atomically replaces a record. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for PostgresConversationStore
impl !UnwindSafe for PostgresConversationStore
impl Freeze for PostgresConversationStore
impl Send for PostgresConversationStore
impl Sync for PostgresConversationStore
impl Unpin for PostgresConversationStore
impl UnsafeUnpin for PostgresConversationStore
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