pub struct WriteHandle { /* private fields */ }Expand description
Cheaply cloneable handle. Pass clones to every task that needs to write. Dropping the last clone closes the channel and triggers actor shutdown.
Implementations§
Source§impl WriteHandle
impl WriteHandle
pub async fn remember( &self, episode: Episode, embedding: Embedding, ) -> Result<MemoryId>
Sourcepub async fn remember_as(
&self,
audit_principal: Option<String>,
episode: Episode,
embedding: Embedding,
) -> Result<MemoryId>
pub async fn remember_as( &self, audit_principal: Option<String>, episode: Episode, embedding: Embedding, ) -> Result<MemoryId>
v0.8.0 P4: like remember, but records audit_principal in the
audit_events row. Pass Some(subject) from auth-aware transports
(HTTP via AuthenticatedPrincipal, MCP via cached principal).
None matches CLI / no-auth paths.
Sourcepub async fn remember_batch_as(
&self,
audit_principal: Option<String>,
items: Vec<(Episode, Embedding)>,
) -> Result<Vec<MemoryId>>
pub async fn remember_batch_as( &self, audit_principal: Option<String>, items: Vec<(Episode, Embedding)>, ) -> Result<Vec<MemoryId>>
v0.9.2: atomic batched-remember. See WriteCommand::RememberBatch
for semantics. Returns MemoryIds in input order.
pub async fn forget(&self, memory_id: MemoryId, reason: String) -> Result<()>
Sourcepub async fn forget_as(
&self,
audit_principal: Option<String>,
memory_id: MemoryId,
reason: String,
) -> Result<()>
pub async fn forget_as( &self, audit_principal: Option<String>, memory_id: MemoryId, reason: String, ) -> Result<()>
v0.8.0 P4 audit-aware variant. See Self::remember_as.
pub async fn update( &self, memory_id: MemoryId, content: String, embedding: Embedding, ) -> Result<MemoryUpdateReport>
Sourcepub async fn update_as(
&self,
audit_principal: Option<String>,
memory_id: MemoryId,
content: String,
embedding: Embedding,
) -> Result<MemoryUpdateReport>
pub async fn update_as( &self, audit_principal: Option<String>, memory_id: MemoryId, content: String, embedding: Embedding, ) -> Result<MemoryUpdateReport>
Correct an active episode’s content and embedding through the writer actor so it serializes with remember/forget/drain work.
Sourcepub async fn ingest_document(
&self,
path: PathBuf,
chunk_config: ChunkConfig,
) -> Result<IngestReport>
pub async fn ingest_document( &self, path: PathBuf, chunk_config: ChunkConfig, ) -> Result<IngestReport>
Ingest a document at path using chunk_config for splitting.
See WriteCommand::IngestDocument for the persistence pipeline.
Sourcepub async fn ingest_document_as(
&self,
audit_principal: Option<String>,
path: PathBuf,
chunk_config: ChunkConfig,
) -> Result<IngestReport>
pub async fn ingest_document_as( &self, audit_principal: Option<String>, path: PathBuf, chunk_config: ChunkConfig, ) -> Result<IngestReport>
v0.8.0 P4 audit-aware variant. See Self::remember_as.
Sourcepub async fn forget_document(
&self,
doc_id: DocumentId,
) -> Result<ForgetDocumentReport>
pub async fn forget_document( &self, doc_id: DocumentId, ) -> Result<ForgetDocumentReport>
Soft-delete a document and tombstone its chunks’ HNSW rowids.
See WriteCommand::ForgetDocument for semantics.
Sourcepub async fn forget_document_as(
&self,
audit_principal: Option<String>,
doc_id: DocumentId,
) -> Result<ForgetDocumentReport>
pub async fn forget_document_as( &self, audit_principal: Option<String>, doc_id: DocumentId, ) -> Result<ForgetDocumentReport>
v0.8.0 P4 audit-aware variant. See Self::remember_as.
pub async fn consolidate( &self, scope: ConsolidationScope, ) -> Result<ConsolidationReport>
Sourcepub async fn consolidate_as(
&self,
audit_principal: Option<String>,
scope: ConsolidationScope,
) -> Result<ConsolidationReport>
pub async fn consolidate_as( &self, audit_principal: Option<String>, scope: ConsolidationScope, ) -> Result<ConsolidationReport>
v0.8.0 P4 audit-aware variant. See Self::remember_as.
pub async fn reembed(&self, scope: ReembedScope) -> Result<ReembedReport>
Sourcepub async fn reembed_as(
&self,
audit_principal: Option<String>,
scope: ReembedScope,
) -> Result<ReembedReport>
pub async fn reembed_as( &self, audit_principal: Option<String>, scope: ReembedScope, ) -> Result<ReembedReport>
v0.8.0 P4 audit-aware variant. See Self::remember_as.
Sourcepub async fn backup(&self, dest_path: PathBuf) -> Result<()>
pub async fn backup(&self, dest_path: PathBuf) -> Result<()>
Run an online encrypted backup of the writer’s source database
to dest_path. Available only when the writer was spawned with
a KeyMaterial (see WriterActor::spawn_full_with_key_and_optional_steward).
pub async fn save_snapshot(&self) -> Result<()>
Sourcepub async fn normalize_subjects(
&self,
aliases: Vec<(String, String)>,
dry_run: bool,
) -> Result<NormalizeReport>
pub async fn normalize_subjects( &self, aliases: Vec<(String, String)>, dry_run: bool, ) -> Result<NormalizeReport>
Rewrite historical triples.subject_id / triples.object_id
values for each (from, to) pair in aliases. See
WriteCommand::NormalizeSubjects for semantics.
Sourcepub async fn normalize_subjects_as(
&self,
audit_principal: Option<String>,
aliases: Vec<(String, String)>,
dry_run: bool,
) -> Result<NormalizeReport>
pub async fn normalize_subjects_as( &self, audit_principal: Option<String>, aliases: Vec<(String, String)>, dry_run: bool, ) -> Result<NormalizeReport>
v0.8.0 P4 audit-aware variant. See Self::remember_as.
Sourcepub async fn emit_llm_sampling_audit(&self, event: AuditEvent) -> Result<()>
pub async fn emit_llm_sampling_audit(&self, event: AuditEvent) -> Result<()>
v0.9.0 P2: emit a single AuditOperation::LlmSamplingCall row
into the per-tenant audit_events table via the writer-actor.
The INSERT lands inside a dedicated BEGIN IMMEDIATE
transaction on the writer’s connection (lesson #30: ACID for
the sampling call’s only persisted trace). Insert failures
surface to the caller — SamplingLlmClient propagates them up
so a missed audit row can NOT be silently swallowed.
Privacy invariant: callers MUST construct event.details
with metadata only (model hint, message count, max_tokens,
duration_ms, total prompt char count). The raw prompt content
is user data that the user did NOT consent to log here.
Enforcement lives at the call site
(SamplingLlmClient::audit_event); this method has no way to
scrub a malformed event in the writer-actor.
Sourcepub async fn attach_abstraction_batch(
&self,
items: Vec<(MemoryId, SemanticAbstraction)>,
episode_count: usize,
duration_ms: u64,
clusters_deferred: usize,
audit_principal: Option<String>,
) -> Result<AttachAbstractionBatchReport>
pub async fn attach_abstraction_batch( &self, items: Vec<(MemoryId, SemanticAbstraction)>, episode_count: usize, duration_ms: u64, clusters_deferred: usize, audit_principal: Option<String>, ) -> Result<AttachAbstractionBatchReport>
v0.9.0 P4c: persist a batch of cluster-level abstractions +
their extracted triples in a single writer-actor transaction,
emitting ONE AuditOperation::MemoryTriplesExtract audit row.
Called from the daemon-side consolidate-timer’s triples batch path. The writer-actor handles ACID: every successful (cluster, abstraction) insert + the audit emit land or rollback together. Per-cluster INSERT failures (e.g. cluster row deleted concurrently) log + skip but do NOT abort the batch’s tx.
Sourcepub async fn resolve_contradiction_as(
&self,
audit_principal: Option<String>,
a_id: String,
b_id: String,
kind: String,
status: String,
resolution_note: Option<String>,
winning_triple_id: Option<String>,
) -> Result<ResolveContradictionReport>
pub async fn resolve_contradiction_as( &self, audit_principal: Option<String>, a_id: String, b_id: String, kind: String, status: String, resolution_note: Option<String>, winning_triple_id: Option<String>, ) -> Result<ResolveContradictionReport>
Mark a contradiction resolved / unresolved / reopened (dev-log
0152 H1). Routes through the writer actor so the UPDATE +
audit_events row land atomically in one BEGIN IMMEDIATE
transaction. Status must be one of unresolved | resolved |
reopened. Returns Error::NotFound if the (a_id, b_id, kind)
triple does not match any contradiction row.
Trait Implementations§
Source§impl Clone for WriteHandle
impl Clone for WriteHandle
Source§fn clone(&self) -> WriteHandle
fn clone(&self) -> WriteHandle
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 Freeze for WriteHandle
impl RefUnwindSafe for WriteHandle
impl Send for WriteHandle
impl Sync for WriteHandle
impl Unpin for WriteHandle
impl UnsafeUnpin for WriteHandle
impl UnwindSafe for WriteHandle
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
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