watcher

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package watcher implements the file system watcher using fsnotify.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DebouncedEvent

type DebouncedEvent struct {
	Path       string
	ChangeType events.FileChangeType
	Timer      *time.Timer
}

DebouncedEvent represents a debounced file change event.

type Debouncer

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

Debouncer coalesces rapid file system events.

func NewDebouncer

func NewDebouncer(window time.Duration, callback func(path string, changeType events.FileChangeType)) *Debouncer

NewDebouncer creates a new debouncer with the given window and callback.

func (*Debouncer) Add

func (d *Debouncer) Add(path string, changeType events.FileChangeType)

Add queues an event for debouncing.

func (*Debouncer) Stop

func (d *Debouncer) Stop()

Stop stops all pending timers.

type Watcher

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

Watcher implements the FileWatcher port interface.

func NewWatcher

func NewWatcher(rootPath string, hub ports.EventHub, debounceMS int, ignorePatterns []string) *Watcher

NewWatcher creates a new file system watcher.

func NewWatcherWithWorkspace

func NewWatcherWithWorkspace(rootPath string, hub ports.EventHub, debounceMS int, ignorePatterns []string, workspaceID string) *Watcher

NewWatcherWithWorkspace creates a new file system watcher with workspace context attached to emitted events.

func (*Watcher) AddIgnorePattern

func (w *Watcher) AddIgnorePattern(pattern string)

AddIgnorePattern adds a pattern to the ignore list.

func (*Watcher) IsRunning

func (w *Watcher) IsRunning() bool

IsRunning returns true if the watcher is active.

func (*Watcher) RemoveIgnorePattern

func (w *Watcher) RemoveIgnorePattern(pattern string)

RemoveIgnorePattern removes a pattern from the ignore list.

func (*Watcher) Start

func (w *Watcher) Start(ctx context.Context) error

Start begins watching the repository directory.

func (*Watcher) Stop

func (w *Watcher) Stop() error

Stop terminates file watching.

Jump to

Keyboard shortcuts

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