Thanks to visit codestin.com
Credit goes to pkg.go.dev

watcher

package
v2.22.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package watcher provides file system watching capabilities for the agent. It defines an interface for monitoring file changes and implementations that can be used to detect when configuration files are modified. This is primarily used to track changes to devcontainer configuration files and notify users when containers need to be recreated to apply the new configuration.

Index

Constants

This section is empty.

Variables

View Source
var ErrClosed = xerrors.New("watcher closed")

Functions

This section is empty.

Types

type Watcher

type Watcher interface {
	// Add starts watching a file for changes.
	Add(file string) error

	// Remove stops watching a file for changes.
	Remove(file string) error

	// Next blocks until a file system event occurs or the context is canceled.
	// It returns the next event or an error if the watcher encountered a problem.
	Next(context.Context) (*fsnotify.Event, error)

	// Close shuts down the watcher and releases any resources.
	Close() error
}

Watcher defines an interface for monitoring file system changes. Implementations track file modifications and provide an event stream that clients can consume to react to changes.

func NewFSNotify

func NewFSNotify() (Watcher, error)

NewFSNotify creates a new file system watcher that watches parent directories instead of individual files for more reliable event detection.

func NewNoop

func NewNoop() Watcher

NewNoop creates a new watcher that does nothing.

Jump to

Keyboard shortcuts

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