Documentation
¶
Overview ¶
Package callindex is the call-catalog consumer of the shared indexjobs framework (#507, #1321). It registers a Source/Sink pair under source_kind = "calls" so a recorded call becomes findable by meaning and not only by the words it happens to contain.
A call is recorded on the audit writer's goroutine, where embedding it would mean holding the writer open on a network call to the embedding provider, so the vector is produced off that path: the record lands without one and the reconciler converges it. Like memory, and unlike the api-catalog and tools consumers, the vector lives inline on the row it describes — a record IS its own indexing unit, so SourceID is the record id and each unit yields exactly one item.
Index ¶
- Constants
- type Sink
- func (s *Sink) Coverage(ctx context.Context) (indexjobs.Coverage, error)
- func (s *Sink) FindGaps(ctx context.Context) ([]string, error)
- func (*Sink) Kind() string
- func (s *Sink) ListExisting(ctx context.Context, key indexjobs.Key) (map[string]indexjobs.Vector, error)
- func (*Sink) StampExpected(context.Context, indexjobs.Key, int) error
- func (s *Sink) Upsert(ctx context.Context, key indexjobs.Key, rows []indexjobs.Vector) error
- func (s *Sink) UpsertBatch(ctx context.Context, key indexjobs.Key, rows []indexjobs.Vector) error
- type Source
- type Store
- func (s *Store) Coverage(ctx context.Context) (indexed, expected int, err error)
- func (s *Store) FindGaps(ctx context.Context, currentModel string) ([]string, error)
- func (s *Store) GetText(ctx context.Context, id string) (string, error)
- func (s *Store) ListVectors(ctx context.Context, id string) (map[string]indexjobs.Vector, error)
- func (s *Store) UpsertVectors(ctx context.Context, id string, rows []indexjobs.Vector) error
Constants ¶
const SourceKind = "calls"
SourceKind is the indexjobs source_kind this package serves.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Sink ¶
type Sink struct {
// contains filtered or unexported fields
}
Sink implements indexjobs.Sink for the call kind over the embedding columns of call_records. currentModel is the provider model the gap query diffs stored rows against, so a model swap re-embeds rows stamped with the previous model.
func NewSink ¶
NewSink returns a Sink backed by the given store. currentModel is the embedding provider's model identifier; "" on a deployment whose provider does not name its model, which leaves only NULL-embedding rows as gaps.
func (*Sink) Coverage ¶
Coverage reports the call kind's indexed-vs-expected totals. ExpectedKnown is true: every indexable record is expected to converge to one vector.
func (*Sink) ListExisting ¶
func (s *Sink) ListExisting(ctx context.Context, key indexjobs.Key) (map[string]indexjobs.Vector, error)
ListExisting returns the record's persisted vector keyed by item id for the worker's dedup pass.
func (*Sink) StampExpected ¶
StampExpected is a no-op. Gap detection is condition-based (no vector, or a vector from another model), not count-based, so there is no expected count to record per unit.
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source implements indexjobs.Source for the call kind. A unit is one recorded call (SourceID = record id) and yields exactly one item: the text the record is searched by. The worker embeds it and the Sink writes the vector back onto the same row.
func (*Source) LoadItems ¶
LoadItems returns the record's single embeddable item. A record that was deleted between enqueue and claim, or that holds nothing worth embedding, yields an empty slice: a clean completion that writes no vector.
func (*Source) OnSucceeded ¶
OnSucceeded is a no-op: search reads the vectors off call_records on every query, so there is no in-memory cache to refresh after a backfill.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store reads and writes the embedding state of call_records for this consumer. It is deliberately separate from the catalog's own store: it touches only the embedding columns and the text they are computed from, so the read-path contract does not widen to carry a backfill concern.
func (*Store) Coverage ¶
Coverage returns how many indexable records carry a vector, and how many there are. Both counts are over the same population the gap query walks, so a converged catalog reads as complete rather than as permanently short by the records that were never meant to be embedded.
func (*Store) GetText ¶
GetText returns the text of one record to embed, composed by the catalog's own IndexText so the vector is computed from exactly the corpus the lexical arm matches. A record that no longer exists, failed, or has nothing to say yields errNotIndexable.
func (*Store) ListVectors ¶
ListVectors returns the record's persisted embedding keyed by item id (the record id), for the worker's text-hash and model dedup pass.
func (*Store) UpsertVectors ¶
UpsertVectors writes the embedding back onto the record. A call record holds exactly one item, so there are no sibling rows to delete and Upsert and UpsertBatch are the same write.