mirror of https://github.com/docker/docs.git
store: WatchRange -> WatchTree
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
1d3aa013db
commit
895484ec2a
|
@ -71,7 +71,7 @@ func (s *Discovery) Fetch() ([]*discovery.Entry, error) {
|
|||
|
||||
// Watch is exported
|
||||
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
|
||||
entries, _ := discovery.CreateEntries(convertToStringArray(kv))
|
||||
callback(entries)
|
||||
|
|
|
@ -211,7 +211,7 @@ func (s *Consul) waitForChange(key string) <-chan uint64 {
|
|||
}
|
||||
|
||||
// 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)
|
||||
|
||||
// We get the last index first
|
||||
|
|
|
@ -216,7 +216,7 @@ func (s *Etcd) DeleteTree(prefix string) error {
|
|||
}
|
||||
|
||||
// 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)
|
||||
watchChan := make(chan *etcd.Response)
|
||||
stopChan := make(chan bool)
|
||||
|
|
|
@ -60,7 +60,7 @@ type Store interface {
|
|||
DeleteTree(prefix string) error
|
||||
|
||||
// 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
|
||||
CancelWatchRange(prefix string) error
|
||||
|
|
|
@ -161,7 +161,7 @@ func (s *Zookeeper) DeleteTree(prefix string) error {
|
|||
}
|
||||
|
||||
// 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)
|
||||
_, _, eventChan, err := s.client.ChildrenW(fprefix)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue