From f322fe7f0d512dbeb0d450c7cba3ef62d829757f Mon Sep 17 00:00:00 2001 From: Gyu-Ho Lee Date: Tue, 8 Nov 2016 11:46:52 -0800 Subject: [PATCH] clientv3, ctlv3: document range end requirement --- clientv3/op.go | 5 +++-- etcdctl/README.md | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/clientv3/op.go b/clientv3/op.go index e2afdd528..d3ed55b62 100644 --- a/clientv3/op.go +++ b/clientv3/op.go @@ -215,14 +215,15 @@ func WithPrefix() OpOption { } } -// WithRange specifies the range of 'Get' or 'Delete' requests. +// WithRange specifies the range of 'Get', 'Delete', 'Watch' requests. // For example, 'Get' requests with 'WithRange(end)' returns // the keys in the range [key, end). +// endKey must be lexicographically greater than start key. func WithRange(endKey string) OpOption { return func(op *Op) { op.end = []byte(endKey) } } -// WithFromKey specifies the range of 'Get' or 'Delete' requests +// WithFromKey specifies the range of 'Get', 'Delete', 'Watch' requests // to be equal or greater than the key in the argument. func WithFromKey() OpOption { return WithRange("\x00") } diff --git a/etcdctl/README.md b/etcdctl/README.md index aa4155d38..495acfcc6 100644 --- a/etcdctl/README.md +++ b/etcdctl/README.md @@ -221,7 +221,7 @@ OK ### WATCH [options] [key or prefix] [range_end] -Watch watches events stream on keys or prefixes, [key or prefix, range_end) if `range-end` is given. The watch command runs until it encounters an error or is terminated by the user. +Watch watches events stream on keys or prefixes, [key or prefix, range_end) if `range-end` is given. The watch command runs until it encounters an error or is terminated by the user. If range_end is given, it must be lexicographically greater than key or "\x00". #### Options