From 2bb417bfff61ccabbd28aebaa8921c48d6d5c07c Mon Sep 17 00:00:00 2001 From: Ajit Yagaty Date: Tue, 22 Mar 2016 17:25:20 -0700 Subject: [PATCH] clientv3: Renaming SortByCreatedRev to maintain consistency. Renamed SortByCreatedRev to SortByCreateRevision to be consistent with the naming used for SortByModRevision. --- clientv3/concurrency/key.go | 2 +- clientv3/integration/kv_test.go | 4 ++-- clientv3/op.go | 4 ++-- clientv3/sort.go | 2 +- etcdctlv3/command/get_command.go | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/clientv3/concurrency/key.go b/clientv3/concurrency/key.go index d0905df46..155061995 100644 --- a/clientv3/concurrency/key.go +++ b/clientv3/concurrency/key.go @@ -74,7 +74,7 @@ func waitDelete(ctx context.Context, client *v3.Client, key string, rev int64) e // waitDeletes efficiently waits until all keys matched by Get(key, opts...) are deleted func waitDeletes(ctx context.Context, client *v3.Client, key string, opts ...v3.OpOption) error { - getOpts := []v3.OpOption{v3.WithSort(v3.SortByCreatedRev, v3.SortAscend)} + getOpts := []v3.OpOption{v3.WithSort(v3.SortByCreateRevision, v3.SortAscend)} getOpts = append(getOpts, opts...) resp, err := client.Get(ctx, key, getOpts...) maxRev := int64(math.MaxInt64) diff --git a/clientv3/integration/kv_test.go b/clientv3/integration/kv_test.go index d27348826..4014f6cb4 100644 --- a/clientv3/integration/kv_test.go +++ b/clientv3/integration/kv_test.go @@ -148,11 +148,11 @@ func TestKVRange(t *testing.T) { {Key: []byte("fop"), Value: nil, CreateRevision: 9, ModRevision: 9, Version: 1}, }, }, - // range all with SortByCreatedRev, SortDescend + // range all with SortByCreateRevision, SortDescend { "a", "x", 0, - []clientv3.OpOption{clientv3.WithSort(clientv3.SortByCreatedRev, clientv3.SortDescend)}, + []clientv3.OpOption{clientv3.WithSort(clientv3.SortByCreateRevision, clientv3.SortDescend)}, []*storagepb.KeyValue{ {Key: []byte("fop"), Value: nil, CreateRevision: 9, ModRevision: 9, Version: 1}, diff --git a/clientv3/op.go b/clientv3/op.go index 50fa7a974..b0e715f5b 100644 --- a/clientv3/op.go +++ b/clientv3/op.go @@ -209,10 +209,10 @@ func WithSerializable() OpOption { } // WithFirstCreate gets the key with the oldest creation revision in the request range. -func WithFirstCreate() []OpOption { return withTop(SortByCreatedRev, SortAscend) } +func WithFirstCreate() []OpOption { return withTop(SortByCreateRevision, SortAscend) } // WithLastCreate gets the key with the latest creation revision in the request range. -func WithLastCreate() []OpOption { return withTop(SortByCreatedRev, SortDescend) } +func WithLastCreate() []OpOption { return withTop(SortByCreateRevision, SortDescend) } // WithFirstKey gets the lexically first key in the request range. func WithFirstKey() []OpOption { return withTop(SortByKey, SortAscend) } diff --git a/clientv3/sort.go b/clientv3/sort.go index 14d1643ae..06a23be7b 100644 --- a/clientv3/sort.go +++ b/clientv3/sort.go @@ -26,7 +26,7 @@ const ( const ( SortByKey SortTarget = iota SortByVersion - SortByCreatedRev + SortByCreateRevision SortByModRevision SortByValue ) diff --git a/etcdctlv3/command/get_command.go b/etcdctlv3/command/get_command.go index 99746adbd..08050a329 100644 --- a/etcdctlv3/command/get_command.go +++ b/etcdctlv3/command/get_command.go @@ -96,7 +96,7 @@ func getGetOp(cmd *cobra.Command, args []string) (string, []clientv3.OpOption) { sortTarget := strings.ToUpper(getSortTarget) switch { case sortTarget == "CREATE": - sortByTarget = clientv3.SortByCreatedRev + sortByTarget = clientv3.SortByCreateRevision case sortTarget == "KEY": sortByTarget = clientv3.SortByKey case sortTarget == "MODIFY":