Close shuts down the engine.
()
| 217 | |
| 218 | // Close shuts down the engine. |
| 219 | func (e *Engine) Close() error { |
| 220 | if e.closed.Swap(true) { |
| 221 | return nil |
| 222 | } |
| 223 | close(e.closeCh) |
| 224 | e.mu.Lock() |
| 225 | for _, rs := range e.roots { |
| 226 | rs.cancel() |
| 227 | _ = rs.watcher.Close() |
| 228 | } |
| 229 | e.roots = make(map[string]*rootState) |
| 230 | e.mu.Unlock() |
| 231 | e.wg.Wait() |
| 232 | return nil |
| 233 | } |
| 234 | |
| 235 | // Rebuild forces a complete re-walk and re-index of a root. |
| 236 | func (e *Engine) Rebuild(ctx context.Context, root string) error { |