Browse Source

clientv3: support creating a Watch from a WatchClient

Anthony Romano 9 years ago
parent
commit
ac96963003
1 changed files with 5 additions and 1 deletions
  1. 5 1
      clientv3/watch.go

+ 5 - 1
clientv3/watch.go

@@ -164,8 +164,12 @@ type watcherStream struct {
 }
 
 func NewWatcher(c *Client) Watcher {
+	return NewWatchFromWatchClient(pb.NewWatchClient(c.conn))
+}
+
+func NewWatchFromWatchClient(wc pb.WatchClient) Watcher {
 	return &watcher{
-		remote:  pb.NewWatchClient(c.conn),
+		remote:  wc,
 		streams: make(map[string]*watchGrpcStream),
 	}
 }