fswatcher

package module
v0.0.0-...-fc15843 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2014 License: BSD-3-Clause Imports: 14 Imported by: 0

README

fswatcher

file/dir fsnotify watcher with recursive

Documentation

Index

Constants

View Source
const (
	STAGE_INIT int = iota // 0
	STAGE_WATCH
	STAGE_LAZY
)
View Source
const (
	// IgnoreThresholdRange is the amount of time in ns to ignore when
	// receiving watch events for the same file+same event
	IgnoreThresholdRange = 1e5
)

Variables

View Source
var DUMMY_EVENT fsnotify.Event

Functions

This section is empty.

Types

type ActEvent

type ActEvent struct {
	Stage    int            // event from which stage, STAGE_INIT or STAGE_WATCH
	Event    fsnotify.Event // underdelay event, exported
	IsFolder bool           // is this a directory?
	UnixNano int64          // mtime of the file
	Inode    uint64         // inode number of the file
	Err      error
	Id       uint64 // fnv64a hash of name
}

ActEvent watcher output event

type PathWatcher

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

PathWatcher is a wrapper around which adds some additional features:

output channel will closed after *PathWatcher.Close() NOTE: when events > 100000/s, a few event may lost and do not handled

func NewPathWatcher

func NewPathWatcher(size int) *PathWatcher

NewPathWatcher creates an instance of PathWatcher.

func (*PathWatcher) Close

func (self *PathWatcher) Close() error

Close closes the watcher channels.

func (*PathWatcher) Count

func (self *PathWatcher) Count() uint64

Count

func (*PathWatcher) DelWatchFilter

func (self *PathWatcher) DelWatchFilter(inc bool, pattern string) error

DelWatchFilter filter effect scanning path inc == true to del INCLUDE filter inc == false to del EXCLUDE filter

func (*PathWatcher) Dump

func (self *PathWatcher) Dump(tip string)

func (*PathWatcher) GetEventChan

func (self *PathWatcher) GetEventChan() <-chan interface{}

GetEventChan gets event chan.

func (*PathWatcher) SetMaxCacheIdle

func (self *PathWatcher) SetMaxCacheIdle(l time.Duration) time.Duration

SetMaxCacheIdle

func (*PathWatcher) SetThreshold

func (self *PathWatcher) SetThreshold(l int64) int64

SetThreshold, ns

func (*PathWatcher) SetWatchFilter

func (self *PathWatcher) SetWatchFilter(inc bool, pattern string) error

SetWatchFilter filter effect scanning path inc == true to set INCLUDE filter inc == false to set EXCLUDE filter

func (*PathWatcher) Stat

func (self *PathWatcher) Stat() (uint64, uint64, uint64)

Stat watching, cache, pending event

func (*PathWatcher) Sum64a

func (self *PathWatcher) Sum64a(data string) uint64

Sum64a

func (*PathWatcher) Watch

func (self *PathWatcher) Watch(path string, ignoreScanError bool) (<-chan interface{}, error)

Watch watches a directory, do not include sub-dir

func (*PathWatcher) WatchRecursive

func (self *PathWatcher) WatchRecursive(path string, ignoreScanError bool) (<-chan interface{}, error)

WatchRecursive watches a directory recursively. If a dir is created within directory it is also watched.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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