vfswatch

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

This package implements a polling-based file watcher designed for use by both the CLI watcher and the language server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileWatcher

type FileWatcher struct {
	// contains filtered or unexported fields
}

func NewFileWatcher

func NewFileWatcher(fs vfs.FS, pollInterval time.Duration, testing bool, callback func()) *FileWatcher

func (*FileWatcher) HasChangesFromWatchState

func (fw *FileWatcher) HasChangesFromWatchState() bool

HasChangesFromWatchState compares the current filesystem against the stored watch state. Safe for concurrent use: watchState and wildcardDirectories are snapshotted under lock; the maps themselves are never mutated after creation (UpdateWatchState replaces them).

func (*FileWatcher) Run

func (fw *FileWatcher) Run(now func() time.Time)

func (*FileWatcher) SetPollInterval

func (fw *FileWatcher) SetPollInterval(d time.Duration)

func (*FileWatcher) UpdateWatchState

func (fw *FileWatcher) UpdateWatchState(paths []string, wildcardDirs map[string]bool)

func (*FileWatcher) WaitForSettled

func (fw *FileWatcher) WaitForSettled(now func() time.Time)

func (*FileWatcher) WatchStateEntry

func (fw *FileWatcher) WatchStateEntry(path string) (WatchEntry, bool)

func (*FileWatcher) WatchStateUninitialized

func (fw *FileWatcher) WatchStateUninitialized() bool

type WatchEntry

type WatchEntry struct {
	ModTime      time.Time
	Exists       bool
	ChildrenHash uint64 // 0 if not tracked
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL