func (wh *watcherHub) notify(e *Event) {
	e = wh.EventHistory.addEvent(e)  
	segments := strings.Split(e.Node.Key, "/")
	currPath := "/"
	for _, segment := range segments {
		currPath = path.Join(currPath, segment)
		wh.notifyWatchers(e, currPath, false)
	}
}
notify function accepts an event and notify to the watchers.
package store
import (
	"container/list"
	"path"
	"strings"
	"sync"
	"sync/atomic"
	etcdErr "github.com/coreos/etcd/error"
)
type watcherHub struct {
	count int64  
	mutex        sync.Mutex
	watchers     map[string]*list.List
	EventHistory *EventHistory
}
func newWatchHub(capacity int) *watcherHub {
	return &watcherHub{
		watchers:     make(map[string]*list.List),
		EventHistory: newEventHistory(capacity),
	}
}
func (wh *watcherHub) watch(key string, recursive, stream bool, index, storeIndex uint64) (Watcher, *etcdErr.Error) {
	reportWatchRequest()
	event, err := wh.EventHistory.scan(key, recursive, index)
	if err != nil {
		err.Index = storeIndex
		return nil, err
	}
	w := &watcher{
		eventChan:  make(chan *Event, 100),  
		recursive:  recursive,
		stream:     stream,
		sinceIndex: index,
		startIndex: storeIndex,
		hub:        wh,
	}
	wh.mutex.Lock()
	defer wh.mutex.Unlock()
	if event != nil {
		ne := event.Clone()
		ne.EtcdIndex = storeIndex
		w.eventChan <- ne
		return w, nil
	}
	l, ok := wh.watchers[key]
	var elem *list.Element
	if ok {  
		elem = l.PushBack(w)
	} else {  
		l = list.New()
		elem = l.PushBack(w)
		wh.watchers[key] = l
	}
	w.remove = func() {
		if w.removed {  
			return
		}
		w.removed = true
		l.Remove(elem)
		atomic.AddInt64(&wh.count, -1)
		reportWatcherRemoved()
		if l.Len() == 0 {
			delete(wh.watchers, key)
		}
	}
	atomic.AddInt64(&wh.count, 1)
	reportWatcherAdded()
	return w, nil
}