embed

package
v0.17.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 4 Imported by: 0

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

func New(interval time.Duration, backfill func(context.Context) (int, error)) *Maintainer

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL