Skip to main content

Module pipeline

Module pipeline 

Source
Expand description

Non-blocking write pipeline.

Per TODO.md:136-145, the write path on a post-cortex service must return as soon as the entry is durably persisted in storage — the derived work (embedding compute + HNSW upsert, entity-graph upsert, summary refresh, …) belongs on background workers. This module provides the bounded MPSC queues + per-queue worker tasks that take that work off the hot path.

§Layout

Three independent queues, each with its own worker task spawned at Pipeline::start:

  • embedding::EmbeddingQueue — submit a vectorisation request, worker calls into the content vectorizer asynchronously.
  • graph::GraphQueue — submit entity / relation upserts, worker merges them into the entity graph + persists them.
  • summary::SummaryQueue — submit a session-id, worker re-generates the structured summary view.

Bounded capacities are set per-queue; when full, any submit_* method returns PipelineError::Backpressure so callers can decide whether to retry, drop, or fall back to inline execution.

§Status

Phase 5 lands the queue scaffolding and worker tasks; the workers currently log+record metrics but do not yet drive the production pipelines (content vectorizer, graph manager, summary generator). Phase 7 wires the workers to the real components when the daemon’s gRPC handlers migrate to call crate::MemoryServiceImpl via the trait — which is the same commit that converts update_context to return early after persist. Until then the legacy in-process pipeline inside crate::ConversationMemorySystem continues to run synchronously.

Re-exports§

pub use embedding::EmbeddingQueue;
pub use embedding::EmbeddingWorkItem;
pub use graph::GraphQueue;
pub use graph::GraphWorkItem;
pub use summary::SummaryQueue;
pub use summary::SummaryWorkItem;

Modules§

embedding
Embedding work queue.
graph
Entity-graph work queue.
summary
Summary-refresh work queue.

Structs§

Pipeline
Top-level non-blocking pipeline. Owns all three queue handles and the gauge tracking total in-flight work.
PipelineConfig
Configuration for the bounded work queues.

Enums§

PipelineError
Error returned when a queue submission fails.