File: fswatch.go

package info (click to toggle)
golang-github-gokyle-fswatch 0.0~git20121217.1dbdf83-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 84 kB
  • sloc: makefile: 3
file content (35 lines) | stat: -rw-r--r-- 1,090 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package fswatch

import (
	"time"
)

// These values represent the events fswatch knows about. fswatch uses a
// stat(2) call to look up file information; a file will only have a NOPERM
// event if the parent directory has no search permission (i.e. parent
// directory doesn't have executable permissions for the current user).
const (
	NONE     = iota // No event, initial state.
	CREATED         // File was created.
	DELETED         // File was deleted.
	MODIFIED        // File was modified.
	PERM            // Changed permissions
	NOEXIST         // File does not exist.
	NOPERM          // No permissions for the file (see const block comment).
	INVALID         // Any type of error not represented above.
)

// NotificationBufLen is the number of notifications that should be buffered
// in the channel.
var NotificationBufLen = 16

// WatchDelay is the duration between path scans. It defaults to 100ms.
var WatchDelay time.Duration

func init() {
	del, err := time.ParseDuration("100ms")
	if err != nil {
		panic("couldn't set up fswatch: " + err.Error())
	}
	WatchDelay = del
}