forked from dshills/goauto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
watcher.go
41 lines (34 loc) · 791 Bytes
/
watcher.go
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
36
37
38
39
40
41
// Copyright 2015 Davin Hills. All rights reserved.
// MIT license. License details can be found in the LICENSE file.
package goauto
import (
"io"
"time"
)
// Op describes a set of file operations.
// Mimics fsnotify
type Op uint32
// These are the generalized file operations that can trigger a notification.
// Mimics fsnotify
const (
Create Op = 1 << iota
Write
Remove
Rename
Chmod
)
// Event represents a file system notification
type Event struct {
Path string
Op Op
}
// ESlice is an Event buffer
type ESlice []*Event
// A Watcher represents a gneric type of file system monitor
type Watcher interface {
SetVerbose(out io.Writer)
Start(latency time.Duration, paths []string) (<-chan ESlice, error)
Stop() error
Add(path string) error
Remove(path string) error
}