MCPcopy Index your code
hub / github.com/docker/docker-agent / CheckAndReindexChangedFiles

Method CheckAndReindexChangedFiles

pkg/rag/manager.go:472–493  ·  view source on GitHub ↗

CheckAndReindexChangedFiles checks for file changes and re-indexes if needed

(ctx context.Context)

Source from the content-addressed store, hash-verified

470
471// CheckAndReindexChangedFiles checks for file changes and re-indexes if needed
472func (m *Manager) CheckAndReindexChangedFiles(ctx context.Context) (err error) {
473 tracer := otel.Tracer("github.com/docker/docker-agent/pkg/rag")
474 ctx, span := tracer.Start(ctx, "rag.reindex",
475 trace.WithSpanKind(trace.SpanKindInternal),
476 trace.WithAttributes(attribute.String(genai.AttrDataSourceID, m.name)),
477 )
478 defer func() {
479 if err != nil {
480 span.RecordError(err)
481 span.SetStatus(codes.Error, err.Error())
482 }
483 span.End()
484 }()
485
486 for strategyName, strategyImpl := range m.strategies {
487 strategyCfg := m.strategyConfigs[strategyName]
488 if err := strategyImpl.CheckAndReindexChangedFiles(ctx, strategyCfg.Docs, strategyCfg.Chunking); err != nil {
489 return fmt.Errorf("strategy %s failed: %w", strategyName, err)
490 }
491 }
492 return nil
493}
494
495// StartFileWatcher starts monitoring files and directories for changes
496func (m *Manager) StartFileWatcher(ctx context.Context) (err error) {

Callers

nothing calls this directly

Calls 6

StartMethod · 0.65
RecordErrorMethod · 0.65
StringMethod · 0.45
ErrorMethod · 0.45
EndMethod · 0.45

Tested by

no test coverage detected