From fb7dd0f688a0fb91ae15a190807876f8f9c553c5 Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Mon, 13 Feb 2017 12:37:44 -0800 Subject: [PATCH] etcdserverpb, clientv3: clarify WithLimit documentation Fixes #7316 --- Documentation/dev-guide/api_reference_v3.md | 2 +- clientv3/op.go | 1 + etcdserver/etcdserverpb/rpc.pb.go | 3 ++- etcdserver/etcdserverpb/rpc.proto | 3 ++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Documentation/dev-guide/api_reference_v3.md b/Documentation/dev-guide/api_reference_v3.md index 9a318d589..771c16dc0 100644 --- a/Documentation/dev-guide/api_reference_v3.md +++ b/Documentation/dev-guide/api_reference_v3.md @@ -636,7 +636,7 @@ Empty field. | ----- | ----------- | ---- | | key | default, no sorting lowest target value first highest target value first key is the first key for the range. If range_end is not given, the request only looks up key. | bytes | | range_end | range_end is the upper bound on the requested range [key, range_end). If range_end is '\0', the range is all keys >= key. If range_end is key plus one (e.g., "aa"+1 == "ab", "a\xff"+1 == "b"), then the range request gets all keys prefixed with key. If both key and range_end are '\0', then the range request returns all keys. | bytes | -| limit | limit is a limit on the number of keys returned for the request. | int64 | +| limit | limit is a limit on the number of keys returned for the request. When limit is set to 0, it is treated as no limit. | int64 | | revision | revision is the point-in-time of the key-value store to use for the range. If revision is less or equal to zero, the range is over the newest key-value store. If the revision has been compacted, ErrCompacted is returned as a response. | int64 | | sort_order | sort_order is the order for returned sorted results. | SortOrder | | sort_target | sort_target is the key-value field to use for sorting. | SortTarget | diff --git a/clientv3/op.go b/clientv3/op.go index 1e58b4088..9f73c50bb 100644 --- a/clientv3/op.go +++ b/clientv3/op.go @@ -211,6 +211,7 @@ func WithLease(leaseID LeaseID) OpOption { } // WithLimit limits the number of results to return from 'Get' request. +// If WithLimit is given a 0 limit, it is treated as no limit. func WithLimit(n int64) OpOption { return func(op *Op) { op.limit = n } } // WithRev specifies the store revision for 'Get' request. diff --git a/etcdserver/etcdserverpb/rpc.pb.go b/etcdserver/etcdserverpb/rpc.pb.go index f4d2d3633..38bda5dd7 100644 --- a/etcdserver/etcdserverpb/rpc.pb.go +++ b/etcdserver/etcdserverpb/rpc.pb.go @@ -232,7 +232,8 @@ type RangeRequest struct { // then the range request gets all keys prefixed with key. // If both key and range_end are '\0', then the range request returns all keys. RangeEnd []byte `protobuf:"bytes,2,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"` - // limit is a limit on the number of keys returned for the request. + // limit is a limit on the number of keys returned for the request. When limit is set to 0, + // it is treated as no limit. Limit int64 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` // revision is the point-in-time of the key-value store to use for the range. // If revision is less or equal to zero, the range is over the newest key-value store. diff --git a/etcdserver/etcdserverpb/rpc.proto b/etcdserver/etcdserverpb/rpc.proto index 372dea955..7bca90c15 100644 --- a/etcdserver/etcdserverpb/rpc.proto +++ b/etcdserver/etcdserverpb/rpc.proto @@ -356,7 +356,8 @@ message RangeRequest { // then the range request gets all keys prefixed with key. // If both key and range_end are '\0', then the range request returns all keys. bytes range_end = 2; - // limit is a limit on the number of keys returned for the request. + // limit is a limit on the number of keys returned for the request. When limit is set to 0, + // it is treated as no limit. int64 limit = 3; // revision is the point-in-time of the key-value store to use for the range. // If revision is less or equal to zero, the range is over the newest key-value store.