watcher

package
v0.0.0-...-a1d2bbf Latest Latest
Warning

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

Go to latest
Published: May 5, 2019 License: MIT Imports: 6 Imported by: 0

README

Watcher

Wrapper around fsnotify to watch changes in system files and push updates to VTree.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Watcher

type Watcher struct {
	// Done channel used to indicate when to stop the watcher
	Done chan bool

	// Path is absolute path to watch.
	Path string

	// Notifier holds the fs watcher
	Notifier *fsnotify.Watcher
}

Watcher is a wrapper to fsnotify watcher and represents a path to watch for usr changes.

func NewWatcher

func NewWatcher(p string) (*Watcher, error)

NewWatcher initialize a new Watcher.

func (*Watcher) AddToWatchList

func (w *Watcher) AddToWatchList(p string)

AddToWatchList adds path to watch.

func (*Watcher) BatchAdd

func (w *Watcher) BatchAdd(paths []string)

BatchAdd adds multiple paths to watcher.

func (*Watcher) RemoveFromWatchList

func (w *Watcher) RemoveFromWatchList(p string)

RemoveFromWatchList traverse a path and remove all nested dir path from the notifier watch list.

func (*Watcher) Start

func (w *Watcher) Start(vt *vtree.VTree)

Start initialize watcher notifier and check for the notifier Event channel and Errors channel.

func (*Watcher) Stop

func (w *Watcher) Stop()

Stop close the fs watcher and triggers the Done channel.

Jump to

Keyboard shortcuts

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