Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher polls indexed projects for file changes and triggers re-indexing. Change detection uses a 3-tier strategy per project:
- Git — git status + HEAD tracking (for git repos)
- FSNotify — event-driven via OS file notifications (for non-git dirs)
- Dir-mtime — directory mtime polling (fallback if fsnotify setup fails)
func New ¶
func New(r *store.StoreRouter, indexFn IndexFunc) *Watcher
New creates a Watcher. indexFn is called when file changes are detected.
func (*Watcher) Run ¶
Run blocks until ctx is cancelled. Ticks at baseInterval, polling each project only when its adaptive interval has elapsed.
func (*Watcher) Strategies ¶
Strategies returns a snapshot of the current change-detection strategy per watched project. Useful for surfacing silent degradations (e.g., a project that probed as "git" but downgraded to "dirmtime" after git failures). Returned map is safe to mutate.
func (*Watcher) TouchProject ¶
TouchProject refreshes a project's timestamp in the watch list. If the project isn't watched yet, adds it (looks up rootPath from DB).