|
@@ -26,7 +26,7 @@ import (
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
type watchProxy struct {
|
|
type watchProxy struct {
|
|
|
- c *clientv3.Client
|
|
|
|
|
|
|
+ cw clientv3.Watcher
|
|
|
wgs watchergroups
|
|
wgs watchergroups
|
|
|
|
|
|
|
|
mu sync.Mutex
|
|
mu sync.Mutex
|
|
@@ -35,9 +35,9 @@ type watchProxy struct {
|
|
|
|
|
|
|
|
func NewWatchProxy(c *clientv3.Client) pb.WatchServer {
|
|
func NewWatchProxy(c *clientv3.Client) pb.WatchServer {
|
|
|
return &watchProxy{
|
|
return &watchProxy{
|
|
|
- c: c,
|
|
|
|
|
|
|
+ cw: c.Watcher,
|
|
|
wgs: watchergroups{
|
|
wgs: watchergroups{
|
|
|
- c: c,
|
|
|
|
|
|
|
+ cw: c.Watcher,
|
|
|
groups: make(map[watchRange]*watcherGroup),
|
|
groups: make(map[watchRange]*watcherGroup),
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
@@ -49,7 +49,7 @@ func (wp *watchProxy) Watch(stream pb.Watch_WatchServer) (err error) {
|
|
|
wp.mu.Unlock()
|
|
wp.mu.Unlock()
|
|
|
|
|
|
|
|
sws := serverWatchStream{
|
|
sws := serverWatchStream{
|
|
|
- c: wp.c,
|
|
|
|
|
|
|
+ cw: wp.cw,
|
|
|
groups: &wp.wgs,
|
|
groups: &wp.wgs,
|
|
|
|
|
|
|
|
id: wp.nextStreamID,
|
|
id: wp.nextStreamID,
|
|
@@ -68,7 +68,7 @@ func (wp *watchProxy) Watch(stream pb.Watch_WatchServer) (err error) {
|
|
|
|
|
|
|
|
type serverWatchStream struct {
|
|
type serverWatchStream struct {
|
|
|
id int64
|
|
id int64
|
|
|
- c *clientv3.Client
|
|
|
|
|
|
|
+ cw clientv3.Watcher
|
|
|
|
|
|
|
|
mu sync.Mutex // make sure any access of groups and singles is atomic
|
|
mu sync.Mutex // make sure any access of groups and singles is atomic
|
|
|
groups *watchergroups
|
|
groups *watchergroups
|
|
@@ -170,7 +170,7 @@ func (sws *serverWatchStream) addDedicatedWatcher(w watcher, rev int64) {
|
|
|
|
|
|
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
|
|
|
|
|
|
- wch := sws.c.Watch(ctx,
|
|
|
|
|
|
|
+ wch := sws.cw.Watch(ctx,
|
|
|
w.wr.key, clientv3.WithRange(w.wr.end),
|
|
w.wr.key, clientv3.WithRange(w.wr.end),
|
|
|
clientv3.WithRev(rev),
|
|
clientv3.WithRev(rev),
|
|
|
clientv3.WithProgressNotify(),
|
|
clientv3.WithProgressNotify(),
|