MCPcopy Index your code
hub / github.com/coder/coder / RemoveRoot

Method RemoveRoot

agent/filefinder/engine.go:171–187  ·  view source on GitHub ↗

RemoveRoot stops watching a root and removes it.

(root string)

Source from the content-addressed store, hash-verified

169
170// RemoveRoot stops watching a root and removes it.
171func (e *Engine) RemoveRoot(root string) error {
172 absRoot, err := filepath.Abs(root)
173 if err != nil {
174 return xerrors.Errorf("resolve root: %w", err)
175 }
176 e.mu.Lock()
177 defer e.mu.Unlock()
178 rs, exists := e.roots[absRoot]
179 if !exists {
180 return xerrors.Errorf("root %q not found", absRoot)
181 }
182 rs.cancel()
183 _ = rs.watcher.Close()
184 delete(e.roots, absRoot)
185 e.publishSnapshot()
186 return nil
187}
188
189// Search performs a fuzzy file search across all roots.
190func (e *Engine) Search(_ context.Context, query string, opts SearchOptions) ([]Result, error) {

Callers 1

TestEngine_RemoveRootFunction · 0.80

Calls 6

publishSnapshotMethod · 0.95
CloseMethod · 0.65
ErrorfMethod · 0.45
LockMethod · 0.45
UnlockMethod · 0.45
cancelMethod · 0.45

Tested by 1

TestEngine_RemoveRootFunction · 0.64