]> go.fuhry.dev Git - fsnotify.git/commitdiff
remove internal watch and removeWatch methods
authorNathan Youngman <git@nathany.com>
Fri, 20 Jun 2014 03:07:37 +0000 (21:07 -0600)
committerNathan Youngman <git@nathany.com>
Fri, 20 Jun 2014 03:07:37 +0000 (21:07 -0600)
CHANGELOG.md
fsnotify.go
fsnotify_bsd.go
fsnotify_linux.go
fsnotify_windows.go

index c40479b81b5762944e583f2c431a5257b3c77ab1..f0df1d401eb7718dc772ee5258e9fe718642cad6 100644 (file)
@@ -5,6 +5,7 @@
 * Go 1.3+ required on Windows (uses syscall.ERROR_MORE_DATA internally).
 * [internal] remove cookie from Event struct (unused).
 * [internal] Event struct has the same definition across every OS.
+* [internal] remove internal watch and removeWatch methods.
 
 ## v0.11.0 / 2014-06-12
 
index 200e61ad02479a4ffe66d3225dabb571fe7837e8..cd54051b40fd2ff9bb1a30c38e0e376c10f0c442 100644 (file)
@@ -25,16 +25,6 @@ const (
        Chmod
 )
 
-// Add starts watching for operations on the named file.
-func (w *Watcher) Add(path string) error {
-       return w.watch(path)
-}
-
-// Remove stops watching for operations on the named file.
-func (w *Watcher) Remove(path string) error {
-       return w.removeWatch(path)
-}
-
 // String formats the event e in the form
 // "filename: REMOVE|WRITE|..."
 func (e *Event) String() string {
index 549b9e486583a289e7d4511bbb631a28b5ca7f0c..25823ccc9122ff3ed896f0d1dff1db27fcac9926 100644 (file)
@@ -115,7 +115,7 @@ func (w *Watcher) Close() error {
        ws := w.watches
        w.pmut.Unlock()
        for path := range ws {
-               w.removeWatch(path)
+               w.Remove(path)
        }
 
        return nil
@@ -216,16 +216,16 @@ func (w *Watcher) addWatch(path string, flags uint32) error {
        return nil
 }
 
-// Watch adds path to the watched file set, watching all events.
-func (w *Watcher) watch(path string) error {
+// Add starts watching on the named file.
+func (w *Watcher) Add(path string) error {
        w.ewmut.Lock()
        w.externalWatches[path] = true
        w.ewmut.Unlock()
        return w.addWatch(path, sys_NOTE_ALLEVENTS)
 }
 
-// RemoveWatch removes path from the watched file set.
-func (w *Watcher) removeWatch(path string) error {
+// Remove stops watching on the named file.
+func (w *Watcher) Remove(path string) error {
        w.wmut.Lock()
        watchfd, ok := w.watches[path]
        w.wmut.Unlock()
@@ -274,7 +274,7 @@ func (w *Watcher) removeWatch(path string) error {
                        // Since these are internal, not much sense in propagating error
                        // to the user, as that will just confuse them with an error about
                        // a path they did not explicitly watch themselves.
-                       w.removeWatch(p)
+                       w.Remove(p)
                }
        }
 
@@ -364,13 +364,13 @@ func (w *Watcher) readEvents() {
                        events = events[1:]
 
                        if fileEvent.Op&Rename == Rename {
-                               w.removeWatch(fileEvent.Name)
+                               w.Remove(fileEvent.Name)
                                w.femut.Lock()
                                delete(w.fileExists, fileEvent.Name)
                                w.femut.Unlock()
                        }
                        if fileEvent.Op&Remove == Remove {
-                               w.removeWatch(fileEvent.Name)
+                               w.Remove(fileEvent.Name)
                                w.femut.Lock()
                                delete(w.fileExists, fileEvent.Name)
                                w.femut.Unlock()
index 1864824a1ed7cc8b8c2b54c49e0d75d455892e31..0d96a32413e11d27e84362b064f19e111d70231a 100644 (file)
@@ -158,13 +158,13 @@ func (w *Watcher) addWatch(path string, flags uint32) error {
        return nil
 }
 
-// Watch adds path to the watched file set, watching all events.
-func (w *Watcher) watch(path string) error {
+// Add starts watching on the named file.
+func (w *Watcher) Add(path string) error {
        return w.addWatch(path, sys_AGNOSTIC_EVENTS)
 }
 
-// RemoveWatch removes path from the watched file set.
-func (w *Watcher) removeWatch(path string) error {
+// Remove stops watching on the named file.
+func (w *Watcher) Remove(path string) error {
        w.mu.Lock()
        defer w.mu.Unlock()
        watch, ok := w.watches[path]
index 77ba5e9445ca7f370c2a5de14fde5d73e3ea8fc9..a493b4ef7a6f7a979d8e658d3f253459d20a08a8 100644 (file)
@@ -163,13 +163,13 @@ func (w *Watcher) AddWatch(path string, flags uint32) error {
        return <-in.reply
 }
 
-// Watch adds path to the watched file set, watching all events.
-func (w *Watcher) watch(path string) error {
+// Add starts watching on the named file.
+func (w *Watcher) Add(path string) error {
        return w.AddWatch(path, sys_FS_ALL_EVENTS)
 }
 
-// RemoveWatch removes path from the watched file set.
-func (w *Watcher) removeWatch(path string) error {
+// Remove stops watching on the named file.
+func (w *Watcher) Remove(path string) error {
        in := &input{
                op:    opRemoveWatch,
                path:  filepath.Clean(path),