store: WatchRange -> WatchTree

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2015-05-14 21:40:36 -07:00
parent 1d3aa013db
commit 895484ec2a
5 changed files with 5 additions and 5 deletions

View File

@ -71,7 +71,7 @@ func (s *Discovery) Fetch() ([]*discovery.Entry, error) {
// Watch is exported // Watch is exported
func (s *Discovery) Watch(callback discovery.WatchCallback) { func (s *Discovery) Watch(callback discovery.WatchCallback) {
s.store.WatchRange(s.prefix, "", s.heartbeat, func(kv ...*store.KVEntry) { s.store.WatchTree(s.prefix, "", s.heartbeat, func(kv ...*store.KVEntry) {
// Traduce byte array entries to discovery.Entry // Traduce byte array entries to discovery.Entry
entries, _ := discovery.CreateEntries(convertToStringArray(kv)) entries, _ := discovery.CreateEntries(convertToStringArray(kv))
callback(entries) callback(entries)

View File

@ -211,7 +211,7 @@ func (s *Consul) waitForChange(key string) <-chan uint64 {
} }
// WatchRange triggers a watch on a range of values at "directory" // WatchRange triggers a watch on a range of values at "directory"
func (s *Consul) WatchRange(prefix string, filter string, heartbeat time.Duration, callback WatchCallback) error { func (s *Consul) WatchTree(prefix string, filter string, heartbeat time.Duration, callback WatchCallback) error {
fprefix := s.normalize(prefix) fprefix := s.normalize(prefix)
// We get the last index first // We get the last index first

View File

@ -216,7 +216,7 @@ func (s *Etcd) DeleteTree(prefix string) error {
} }
// WatchRange triggers a watch on a range of values at "directory" // WatchRange triggers a watch on a range of values at "directory"
func (s *Etcd) WatchRange(prefix string, filter string, _ time.Duration, callback WatchCallback) error { func (s *Etcd) WatchTree(prefix string, filter string, _ time.Duration, callback WatchCallback) error {
prefix = normalize(prefix) prefix = normalize(prefix)
watchChan := make(chan *etcd.Response) watchChan := make(chan *etcd.Response)
stopChan := make(chan bool) stopChan := make(chan bool)

View File

@ -60,7 +60,7 @@ type Store interface {
DeleteTree(prefix string) error DeleteTree(prefix string) error
// Watch key namespaces // Watch key namespaces
WatchRange(prefix string, filter string, heartbeat time.Duration, callback WatchCallback) error WatchTree(prefix string, filter string, heartbeat time.Duration, callback WatchCallback) error
// Cancel watch key range // Cancel watch key range
CancelWatchRange(prefix string) error CancelWatchRange(prefix string) error

View File

@ -161,7 +161,7 @@ func (s *Zookeeper) DeleteTree(prefix string) error {
} }
// WatchRange triggers a watch on a range of values at "directory" // WatchRange triggers a watch on a range of values at "directory"
func (s *Zookeeper) WatchRange(prefix string, filter string, _ time.Duration, callback WatchCallback) error { func (s *Zookeeper) WatchTree(prefix string, filter string, _ time.Duration, callback WatchCallback) error {
fprefix := normalize(prefix) fprefix := normalize(prefix)
_, _, eventChan, err := s.client.ChildrenW(fprefix) _, _, eventChan, err := s.client.ChildrenW(fprefix)
if err != nil { if err != nil {