fswatcher

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FSWatcher added in v0.13.0

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

FSWatcher watches for changes to a directory on the filesystem and sends a notification to eventCh every time a file in the folder is changed. Although it's possible to watch for individual files, that's not recommended; watch for the file's parent folder instead. That is because, like in Kubernetes which uses system links on mounted volumes, the file may be deleted and recreated with a different inode. Note that changes are batched for 0.5 seconds before notifications are sent as events on a single file often come in batches.

func New added in v0.13.0

func New(opts Options) (*FSWatcher, error)

func (*FSWatcher) Run added in v0.13.0

func (f *FSWatcher) Run(ctx context.Context, eventCh chan<- struct{}) error

type Options added in v0.13.0

type Options struct {
	// Targets is a list of directories to watch for changes.
	Targets []string

	// Interval is the interval to wait before sending a notification after a file has changed.
	// Default to 500ms.
	Interval *time.Duration
}

Options are the options for the FSWatcher.

Jump to

Keyboard shortcuts

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