Skip to main content

WriteHandle

Struct WriteHandle 

Source
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

Source

pub async fn remember( &self, episode: Episode, embedding: Embedding, ) -> Result<MemoryId>

Source

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.

Source

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.

Source

pub async fn forget(&self, memory_id: MemoryId, reason: String) -> Result<()>

Source

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.

Source

pub async fn update( &self, memory_id: MemoryId, content: String, embedding: Embedding, ) -> Result<MemoryUpdateReport>

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub async fn consolidate( &self, scope: ConsolidationScope, ) -> Result<ConsolidationReport>

Source

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.

Source

pub async fn reembed(&self, scope: ReembedScope) -> Result<ReembedReport>

Source

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.

Source

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).

Source

pub async fn save_snapshot(&self) -> Result<()>

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> WriteHandle

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WriteHandle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more