github.com/gofunct/common@v0.0.0-20190131174352-fd058c7fbf22/pkg/fs/watcher/fswatch/fswatch.go (about) 1 package fswatch 2 3 import ( 4 "time" 5 ) 6 7 // These values represent the events fswatch knows about. fswatch uses a 8 // stat(2) call to look up file information; a file will only have a NOPERM 9 // event if the parent directory has no search permission (i.e. parent 10 // directory doesn't have executable permissions for the current user). 11 const ( 12 NONE = iota // No event, initial state. 13 CREATED // File was created. 14 DELETED // File was deleted. 15 MODIFIED // File was modified. 16 PERM // Changed permissions 17 NOEXIST // File does not exist. 18 NOPERM // No permissions for the file (see const block comment). 19 INVALID // Any type of error not represented above. 20 ) 21 22 // NotificationBufLen is the number of notifications that should be buffered 23 // in the channel. 24 var NotificationBufLen = 16 25 26 // WatchDelay is the duration between path scans. It defaults to 100ms. 27 var WatchDelay time.Duration 28 29 func init() { 30 del, err := time.ParseDuration("100ms") 31 if err != nil { 32 panic("couldn't set up fswatch: " + err.Error()) 33 } 34 WatchDelay = del 35 }