Documentation ¶
Index ¶
- Constants
- Variables
- type ActEvent
- type PathWatcher
- func (self *PathWatcher) Close() error
- func (self *PathWatcher) Count() uint64
- func (self *PathWatcher) DelWatchFilter(inc bool, pattern string) error
- func (self *PathWatcher) Dump(tip string)
- func (self *PathWatcher) GetEventChan() <-chan interface{}
- func (self *PathWatcher) SetMaxCacheIdle(l time.Duration) time.Duration
- func (self *PathWatcher) SetThreshold(l int64) int64
- func (self *PathWatcher) SetWatchFilter(inc bool, pattern string) error
- func (self *PathWatcher) Stat() (uint64, uint64, uint64)
- func (self *PathWatcher) Sum64a(data string) uint64
- func (self *PathWatcher) Watch(path string, ignoreScanError bool) (<-chan interface{}, error)
- func (self *PathWatcher) WatchRecursive(path string, ignoreScanError bool) (<-chan interface{}, error)
Constants ¶
const ( STAGE_INIT int = iota // 0 STAGE_WATCH STAGE_LAZY )
const ( // IgnoreThresholdRange is the amount of time in ns to ignore when // receiving watch events for the same file+same event IgnoreThresholdRange = 1e5 )
Variables ¶
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) 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) 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.