Use keybuilders in watcher creation
@@ -3,7 +3,6 @@ package etcd
import (
"context"
"encoding/json"
- "path"
"github.com/coreos/etcd/clientv3"
"github.com/coreos/etcd/mvcc/mvccpb"
@@ -34,8 +33,7 @@ func (s *etcdStore) GetCheckConfigWatcher(ctx context.Context) <-chan store.Watc
go func() {
watcher := clientv3.NewWatcher(s.client)
- path := path.Join(etcdRoot, checksPathPrefix)
- watcherChan := watcher.Watch(ctx, path, clientv3.WithPrefix(), clientv3.WithCreatedNotify())
+ watcherChan := watcher.Watch(ctx, checkKeyBuilder.build(""), clientv3.WithPrefix(), clientv3.WithCreatedNotify())
defer close(ch)
var (
@@ -78,8 +76,7 @@ func (s *etcdStore) GetAssetWatcher(ctx context.Context) <-chan store.WatchEvent
go func() {
watcher := clientv3.NewWatcher(s.client)
- path := path.Join(etcdRoot, assetsPathPrefix)
- watcherChan := watcher.Watch(ctx, path, clientv3.WithPrefix(), clientv3.WithCreatedNotify())
+ watcherChan := watcher.Watch(ctx, assetKeyBuilder.build(""), clientv3.WithPrefix(), clientv3.WithCreatedNotify())
defer close(ch)
var (
@@ -122,8 +119,7 @@ func (s *etcdStore) GetHookConfigWatcher(ctx context.Context) <-chan store.Watch
go func() {
watcher := clientv3.NewWatcher(s.client)
- path := path.Join(etcdRoot, hooksPathPrefix)
- watcherChan := watcher.Watch(ctx, path, clientv3.WithPrefix(), clientv3.WithCreatedNotify())
+ watcherChan := watcher.Watch(ctx, hookKeyBuilder.build(""), clientv3.WithPrefix(), clientv3.WithCreatedNotify())
defer close(ch)
var (
