From d70a9615ec65d6ce439dcb200d269775dfbe4b6e Mon Sep 17 00:00:00 2001 From: Wojciech Tyczynski Date: Thu, 6 Oct 2016 15:38:34 +0200 Subject: [PATCH] Minor clearnup in etcd3 code --- pkg/storage/etcd3/store.go | 8 ++++---- pkg/storage/etcd3/watcher_test.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/storage/etcd3/store.go b/pkg/storage/etcd3/store.go index 94659e14ace..052bd3b2a08 100644 --- a/pkg/storage/etcd3/store.go +++ b/pkg/storage/etcd3/store.go @@ -314,21 +314,21 @@ func (s *store) List(ctx context.Context, key, resourceVersion string, pred stor // Watch implements storage.Interface.Watch. func (s *store) Watch(ctx context.Context, key string, resourceVersion string, pred storage.SelectionPredicate) (watch.Interface, error) { - return s.watch(ctx, key, resourceVersion, storage.SimpleFilter(pred), false) + return s.watch(ctx, key, resourceVersion, pred, false) } // WatchList implements storage.Interface.WatchList. func (s *store) WatchList(ctx context.Context, key string, resourceVersion string, pred storage.SelectionPredicate) (watch.Interface, error) { - return s.watch(ctx, key, resourceVersion, storage.SimpleFilter(pred), true) + return s.watch(ctx, key, resourceVersion, pred, true) } -func (s *store) watch(ctx context.Context, key string, rv string, filter storage.FilterFunc, recursive bool) (watch.Interface, error) { +func (s *store) watch(ctx context.Context, key string, rv string, pred storage.SelectionPredicate, recursive bool) (watch.Interface, error) { rev, err := storage.ParseWatchResourceVersion(rv) if err != nil { return nil, err } key = keyWithPrefix(s.pathPrefix, key) - return s.watcher.Watch(ctx, key, int64(rev), recursive, filter) + return s.watcher.Watch(ctx, key, int64(rev), recursive, storage.SimpleFilter(pred)) } func (s *store) getState(getResp *clientv3.GetResponse, key string, v reflect.Value, ignoreNotFound bool) (*objState, error) { diff --git a/pkg/storage/etcd3/watcher_test.go b/pkg/storage/etcd3/watcher_test.go index 98087f89aaa..0ce078b2881 100644 --- a/pkg/storage/etcd3/watcher_test.go +++ b/pkg/storage/etcd3/watcher_test.go @@ -92,7 +92,7 @@ func testWatch(t *testing.T, recursive bool) { }, }} for i, tt := range tests { - w, err := store.watch(ctx, tt.key, "0", storage.SimpleFilter(tt.pred), recursive) + w, err := store.watch(ctx, tt.key, "0", tt.pred, recursive) if err != nil { t.Fatalf("Watch failed: %v", err) }