watcher

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileEventHandler

type FileEventHandler interface {
	OnFileChanged(filepath string)
	OnFileDeleted(filepath string)
}

FileEventHandler handles file system events

type FileWatcher

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

FileWatcher provides common file watching functionality

func NewFileWatcher

func NewFileWatcher(handler FileEventHandler, log *logger.Logger) (*FileWatcher, error)

NewFileWatcher creates a new file watcher

func (*FileWatcher) WatchDirectory

func (w *FileWatcher) WatchDirectory(ctx context.Context, dirPath string) error

WatchDirectory watches a directory recursively without debouncing

func (*FileWatcher) WatchOptionalFile

func (w *FileWatcher) WatchOptionalFile(ctx context.Context, filePath string, debounceMs int) error

WatchOptionalFile watches a single file with debouncing, or waits forever if no file path is provided This is useful for optional configuration files where the watcher should still run even if no file is configured

func (*FileWatcher) WatchSingleFile

func (w *FileWatcher) WatchSingleFile(ctx context.Context, filePath string, debounceMs int) error

WatchSingleFile watches a single file with debouncing

Jump to

Keyboard shortcuts

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