StartFileWatcher starts monitoring files and directories for changes
(ctx context.Context)
| 494 | |
| 495 | // StartFileWatcher starts monitoring files and directories for changes |
| 496 | func (m *Manager) StartFileWatcher(ctx context.Context) (err error) { |
| 497 | tracer := otel.Tracer("github.com/docker/docker-agent/pkg/rag") |
| 498 | ctx, span := tracer.Start(ctx, "rag.file_watcher.start", |
| 499 | trace.WithSpanKind(trace.SpanKindInternal), |
| 500 | trace.WithAttributes(attribute.String(genai.AttrDataSourceID, m.name)), |
| 501 | ) |
| 502 | defer func() { |
| 503 | if err != nil { |
| 504 | span.RecordError(err) |
| 505 | span.SetStatus(codes.Error, err.Error()) |
| 506 | } |
| 507 | span.End() |
| 508 | }() |
| 509 | |
| 510 | for strategyName, strategyImpl := range m.strategies { |
| 511 | strategyCfg := m.strategyConfigs[strategyName] |
| 512 | if err := strategyImpl.StartFileWatcher(ctx, strategyCfg.Docs, strategyCfg.Chunking); err != nil { |
| 513 | return fmt.Errorf("strategy %s failed: %w", strategyName, err) |
| 514 | } |
| 515 | } |
| 516 | return nil |
| 517 | } |
| 518 | |
| 519 | // Events returns the event channel shared by all strategies and RAG operations for this manager. |
| 520 | func (m *Manager) Events() <-chan types.Event { |
nothing calls this directly
no test coverage detected