From 846567b96a66d6c2e19ce325c56da0f40eece140 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Wed, 15 May 2019 09:41:06 +0200 Subject: [PATCH] etcd: add WatchKey function --- internal/etcd/etcd.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/etcd/etcd.go b/internal/etcd/etcd.go index 6a08b1b..a0ea4e8 100644 --- a/internal/etcd/etcd.go +++ b/internal/etcd/etcd.go @@ -301,6 +301,14 @@ func (s *Store) AtomicDelete(ctx context.Context, key string, revision int64) (* return tresp, nil } +func (s *Store) WatchKey(ctx context.Context, prefix string, revision int64) etcdclientv3.WatchChan { + etcdv3Options := []etcdclientv3.OpOption{} + if revision != 0 { + etcdv3Options = append(etcdv3Options, etcdclientv3.WithRev(revision)) + } + return s.c.Watch(ctx, prefix, etcdv3Options...) +} + func (s *Store) Watch(ctx context.Context, prefix string, revision int64) etcdclientv3.WatchChan { etcdv3Options := []etcdclientv3.OpOption{clientv3.WithPrefix()} if revision != 0 {