watching

package
v0.12.0-alpha2 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2020 License: MIT Imports: 5 Imported by: 1

Documentation

Overview

Package watching provides a uniform interface to native filesystem watching facilities.

Index

Constants

View Source
const (
	// NonRecursiveWatchingSupported indicates whether or not the current
	// platform supports native non-recursive watching.
	NonRecursiveWatchingSupported = true
)
View Source
const (
	// RecursiveWatchingSupported indicates whether or not the current platform
	// supports native recursive watching.
	RecursiveWatchingSupported = false
)

Variables

This section is empty.

Functions

func WatchRecursive

func WatchRecursive(_ context.Context, _ string, _ chan string) error

WatchRecursive performs recursive watching on platforms which support doing so natively. This function is not implemented on this platform and will panic if called.

Types

type NonRecursiveMRUWatcher

type NonRecursiveMRUWatcher struct {
	// Errors is a buffer channel (with a capacity of one) that will populated
	// with the first internal error that occurs in the watcher. If an error
	// occurs, the watcher should be stopped.
	Errors chan error
	// contains filtered or unexported fields
}

NonRecursiveMRUWatcher represents a non-recursive native watcher that can watch multiple paths and evict old watches on an LRU-basis.

func NewNonRecursiveMRUWatcher

func NewNonRecursiveMRUWatcher(events chan string, maximumWatches int) (*NonRecursiveMRUWatcher, error)

NewNonRecursiveMRUWatcher creates a new non-recursive watcher that will emit event paths on the specified events channel. The maximumWatcher argument sets the maximum number of watches allowed to exist before LRU-eviction occurs. If maximumWatches is 0, a default limit will be used. This function panics if the events channel is not buffered or the maximumWatches parameter is negative. Unlike recursive watching functions, event paths are not normalized to be root-relative, and delivery is on a best-effort basis (i.e. events will be dropped if not handled promptly).

func (*NonRecursiveMRUWatcher) Stop

func (w *NonRecursiveMRUWatcher) Stop()

Stop terminates all watches.

func (*NonRecursiveMRUWatcher) Unwatch

func (w *NonRecursiveMRUWatcher) Unwatch(path string)

Unwatch removes a watch path from the watcher. Any unwatching error will be reported through the errors channel.

func (*NonRecursiveMRUWatcher) Watch

func (w *NonRecursiveMRUWatcher) Watch(path string)

Watch adds a watch path to the watcher. Any watching error will be reported through the errors channel.

Directories

Path Synopsis
internal
third_party/winfsnotify
Package winfsnotify allows the user to receive file system event notifications on Windows.
Package winfsnotify allows the user to receive file system event notifications on Windows.

Jump to

Keyboard shortcuts

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