Documentation
¶
Overview ¶
Package embed runs a background maintainer that keeps a cortex's semantic embedding index fresh under `noema serve`. Traces created or edited while the server runs get embedded automatically, without a manual `noema embeddings backfill`.
It is deliberately NOT a per-mutation hook: embedding an external endpoint must never block or fail a trace write. Instead the maintainer runs an idempotent backfill pass on an interval (only missing/stale traces are embedded), mirroring the lifecycle of the filesystem watcher and federation syncer — construct, Start, Stop. Freshness is eventual, bounded by the interval.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Maintainer ¶
type Maintainer struct {
// contains filtered or unexported fields
}
Maintainer periodically runs a backfill pass. The pass function is injected (the serve layer wires it to Cortex.EmbedBackfill) so the loop stays free of cortex/embedder dependencies and is trivially testable.
func New ¶
New builds a Maintainer that runs backfill every interval. backfill returns the number of traces embedded and an error; both are for logging only — a failing pass is retried on the next tick.
func (*Maintainer) Start ¶
func (m *Maintainer) Start()
Start launches the background loop. It runs one pass immediately (so a freshly-started server catches up on anything written while it was down), then once per interval until Stop.
func (*Maintainer) Stop ¶
func (m *Maintainer) Stop()
Stop cancels the loop and blocks until the goroutine drains.