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

Method StartFileWatcher

pkg/rag/manager.go:496–517  ·  view source on GitHub ↗

StartFileWatcher starts monitoring files and directories for changes

(ctx context.Context)

Source from the content-addressed store, hash-verified

494
495// StartFileWatcher starts monitoring files and directories for changes
496func (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.
520func (m *Manager) Events() <-chan types.Event {

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected