watcher

package
v0.0.0-...-ebc8c0a Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiscerningListener

type DiscerningListener interface {
	Listener
	WatchDir(info os.FileInfo) bool
	WatchFile(basename string) bool
}

DiscerningListener allows the receiver to selectively watch files.

type Listener

type Listener interface {
	// Refresh is invoked by the watcher on relevant filesystem events.
	// If the listener returns an error, it is served to the user on the current request.
	Refresh() *utils.SourceError
}

Listener is an interface for receivers of filesystem events.

type Watcher

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

Watcher allows listeners to register to be notified of changes under a given directory.

func NewWatcher

func NewWatcher(paths *model.RevelContainer, eagerRefresh bool) *Watcher

Creates a new watched based on the container.

func (*Watcher) Listen

func (w *Watcher) Listen(listener Listener, roots ...string)

Listen registers for events within the given root directories (recursively).

func (*Watcher) Notify

func (w *Watcher) Notify() *utils.SourceError

Notify causes the watcher to forward any change events to listeners. It returns the first (if any) error returned.

func (*Watcher) NotifyWhenUpdated

func (w *Watcher) NotifyWhenUpdated(listener Listener, watcher *fsnotify.Watcher)

NotifyWhenUpdated notifies the watcher when a file event is received.

Jump to

Keyboard shortcuts

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