storage: add watch ID to identify watchings
One watcher includes multiple watchings, and their events are sent out through one channel. For the received event, user would like to know which watching it belongs to. Introduce a watch ID. When watching on some key, user will get a watch ID. The watch ID is attached to all events that is observed by this watch.
This commit is contained in:
@ -49,7 +49,7 @@ func TestNewWatcherCancel(t *testing.T) {
|
||||
s.Put(testKey, testValue)
|
||||
|
||||
w := s.NewWatcher()
|
||||
cancel := w.Watch(testKey, true, 0)
|
||||
_, cancel := w.Watch(testKey, true, 0)
|
||||
|
||||
cancel()
|
||||
|
||||
|
Reference in New Issue
Block a user