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
5package notify
6
7const buffer = 128
8
9type tree interface {
10	Watch(string, chan<- EventInfo, ...Event) error
11	Stop(chan<- EventInfo)
12	Close() error
13}
14
15func 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}
23