monitor

package
v6.2.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// PathSeparator can be used to override the operating system separator.
	PathSeparator = string(os.PathSeparator)
)

Functions

This section is empty.

Types

type FileTree

type FileTree map[string]FileTree

FileTree represents a directory in a filesystem-tree structure.

func (FileTree) AddDir

func (tree FileTree) AddDir(path string) error

AddDir adds a directory to a FileTree. If the path includes subdirectories they are created as necessary.

func (FileTree) AddFile

func (tree FileTree) AddFile(path string) error

AddFile adds a file to a FileTree. If the path includes subdirectories they are created as necessary.

func (FileTree) At

func (tree FileTree) At(path string) (FileTree, error)

At returns a new FileTree rooted at the given path.

func (FileTree) Remove

func (tree FileTree) Remove(path string) error

Remove an entry from a FileTree.

func (FileTree) Visit

func (tree FileTree) Visit(path string, order VisitOrder, fn VisitFunc) error

Visit calls the callback function for the given path and recursively all its contents, if a directory path is passed.

type VisitFunc

type VisitFunc func(path string, isDir bool) error

VisitFunc is the type for a callback to visit the entries on a directory and its subdirectories.

type VisitOrder

type VisitOrder int8

VisitOrder is a two-valued flag used to control how directories are visited.

const (
	// PreOrder has directories visited before their contents.
	PreOrder VisitOrder = iota
	// PostOrder has directories visited after their contents.
	PostOrder
)

type Watcher

type Watcher interface {
	Add(path string) error
	Close() error
	EventChannel() <-chan fsnotify.Event
	ErrorChannel() <-chan error
	Start() error
}

Watcher is an interface for a file watcher akin to fsnotify.Watcher with an additional Start method.

func New

func New(recursive bool) (Watcher, error)

New creates a new Watcher backed by fsnotify with optional recursive logic.

Jump to

Keyboard shortcuts

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