CheckAndReindexChangedFiles checks for file changes and re-indexes if needed
(ctx context.Context)
| 470 | |
| 471 | // CheckAndReindexChangedFiles checks for file changes and re-indexes if needed |
| 472 | func (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 |
| 496 | func (m *Manager) StartFileWatcher(ctx context.Context) (err error) { |
nothing calls this directly
no test coverage detected