Skip to content

Commit

Permalink
etcdctl: add max-bytes flag for get command
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Lin <exlin@google.com>
  • Loading branch information
linxiulei committed Nov 20, 2022
1 parent 5c6c0c5 commit e7df7d4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions etcdctl/ctlv3/command/get_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
var (
getConsistency string
getLimit int64
getMaxBytes int64
getSortOrder string
getSortTarget string
getPrefix bool
Expand All @@ -48,6 +49,7 @@ func NewGetCommand() *cobra.Command {
cmd.Flags().StringVar(&getSortOrder, "order", "", "Order of results; ASCEND or DESCEND (ASCEND by default)")
cmd.Flags().StringVar(&getSortTarget, "sort-by", "", "Sort target; CREATE, KEY, MODIFY, VALUE, or VERSION")
cmd.Flags().Int64Var(&getLimit, "limit", 0, "Maximum number of results")
cmd.Flags().Int64Var(&getMaxBytes, "max-bytes", 0, "Maximum bytes of results")
cmd.Flags().BoolVar(&getPrefix, "prefix", false, "Get keys with matching prefix")
cmd.Flags().BoolVar(&getFromKey, "from-key", false, "Get keys that are greater than or equal to the given key using byte compare")
cmd.Flags().Int64Var(&getRev, "rev", 0, "Specify the kv revision")
Expand Down Expand Up @@ -125,6 +127,7 @@ func getGetOp(args []string) (string, []clientv3.OpOption) {
}

opts = append(opts, clientv3.WithLimit(getLimit))
opts = append(opts, clientv3.WithMaxBytes(getMaxBytes))
if getRev > 0 {
opts = append(opts, clientv3.WithRev(getRev))
}
Expand Down

0 comments on commit e7df7d4

Please sign in to comment.