mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #11462 from jingyih/etcdctl_support_watch_progress_notify
etcdctl: support progress notify option
This commit is contained in:
commit
908f45ebe4
@ -95,6 +95,7 @@ Note that any `etcd_debugging_*` metrics are experimental and subject to change.
|
||||
### etcdctl v3
|
||||
|
||||
- Fix [`etcdctl member add`](https://github.com/etcd-io/etcd/pull/11194) command to prevent potential timeout.
|
||||
- Add [`etcdctl watch --progress-notify`](https://github.com/etcd-io/etcd/pull/11462) flag.
|
||||
|
||||
### gRPC gateway
|
||||
|
||||
|
@ -40,6 +40,7 @@ var (
|
||||
watchPrefix bool
|
||||
watchInteractive bool
|
||||
watchPrevKey bool
|
||||
progressNotify bool
|
||||
)
|
||||
|
||||
// NewWatchCommand returns the cobra command for "watch".
|
||||
@ -54,6 +55,7 @@ func NewWatchCommand() *cobra.Command {
|
||||
cmd.Flags().BoolVar(&watchPrefix, "prefix", false, "Watch on a prefix if prefix is set")
|
||||
cmd.Flags().Int64Var(&watchRev, "rev", 0, "Revision to start watching")
|
||||
cmd.Flags().BoolVar(&watchPrevKey, "prev-kv", false, "get the previous key-value pair before the event happens")
|
||||
cmd.Flags().BoolVar(&progressNotify, "progress-notify", false, "get periodic watch progress notification from server")
|
||||
|
||||
return cmd
|
||||
}
|
||||
@ -154,6 +156,9 @@ func getWatchChan(c *clientv3.Client, args []string) (clientv3.WatchChan, error)
|
||||
if watchPrevKey {
|
||||
opts = append(opts, clientv3.WithPrevKV())
|
||||
}
|
||||
if progressNotify {
|
||||
opts = append(opts, clientv3.WithProgressNotify())
|
||||
}
|
||||
return c.Watch(clientv3.WithRequireLeader(context.Background()), key, opts...), nil
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user