Explorar el Código

clientv3: support creating a Watch from a WatchClient

Anthony Romano hace 9 años
padre
commit
ac96963003
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  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),
 	}
 }