You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i'm confused by the implement of WatchTree in etcd store.
in WatchTree, it returns all values in the directory like this:
for {
// Check if the watch was stopped by the caller
select {
case <-stopCh:
return
default:
}
_, err := watcher.Next(context.Background())
if err != nil {
return
}
list, err = s.List(directory, opts)
if err != nil {
return
}
watchCh <- list
}
why not just return the changed item like this:
for {
// Check if the watch was stopped by the caller
select {
case <-stopCh:
return
default:
}
result, err := watcher.Next(context.Background())
if err != nil {
return
}
watchCh <- &store.KVPair{
Key: key,
Value: []byte(result.Node.Value),
LastIndex: result.Node.ModifiedIndex,
}
}
if key A in directory is changed, just return A and it's value, other keys in directory it's not necessary to return.
This discussion was converted from issue #2 on January 10, 2022 17:13.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
hi,
i'm confused by the implement of WatchTree in etcd store.
in WatchTree, it returns all values in the directory like this:
why not just return the changed item like this:
if key A in directory is changed, just return A and it's value, other keys in directory it's not necessary to return.
Beta Was this translation helpful? Give feedback.
All reactions