| 1 | // Copyright (c) 2014-2015 The Notify Authors. All rights reserved. |
| 2 | // Use of this source code is governed by the MIT license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | package notify |
| 6 | |
| 7 | const buffer = 128 |
| 8 | |
| 9 | type tree interface { |
| 10 | Watch(string, chan<- EventInfo, DoNotWatchFn, ...Event) error |
| 11 | Stop(chan<- EventInfo) |
| 12 | Close() error |
| 13 | } |
| 14 | |
| 15 | func newTree() tree { |
| 16 | c := make(chan EventInfo, buffer) |
| 17 | w := newWatcher(c) |
| 18 | if rw, ok := w.(recursiveWatcher); ok { |
| 19 | return newRecursiveTree(rw, c) |
| 20 | } |
| 21 | return newNonrecursiveTree(w, c, make(chan EventInfo, buffer)) |
| 22 | } |