// Watch watches a given object for changes. func (c *Client) Watch(obj db.Entity) (chan db.Entity, chan error) { path, err := obj.Path() if err != nil { errChan := make(chan error, 1) errChan <- err return nil, errChan } return helpers.WrapWatch(c, obj, path, false, c.watchers, &c.watcherMutex, c.startWatch) }
// Watch watches stuff. func (c *Client) Watch(obj db.Entity) (chan db.Entity, chan error) { path, err := obj.Path() if err != nil { errChan := make(chan error, 1) errChan <- err return nil, errChan } // these paths are qualified in watchInternal return helpers.WrapWatch(c, obj, path, false, c.watchers, &c.watcherMutex, c.watchInternal) }
// WatchPrefix watches a directory prefix for changes. func (c *Client) WatchPrefix(obj db.Entity) (chan db.Entity, chan error) { // these paths are qualified in watchInternal return helpers.WrapWatch(c, obj, obj.Prefix(), true, c.watchers, &c.watcherMutex, c.watchInternal) }
// WatchPrefix watches all items under the given entity's prefix func (c *Client) WatchPrefix(obj db.Entity) (chan db.Entity, chan error) { return helpers.WrapWatch(c, obj, obj.Prefix(), true, c.watchers, &c.watcherMutex, c.startWatch) }