clientv3: Renaming SortByCreatedRev to maintain consistency.

Renamed SortByCreatedRev to SortByCreateRevision to be consistent
with the naming used for SortByModRevision.
This commit is contained in:
Ajit Yagaty
2016-03-22 17:25:20 -07:00
parent 606889a002
commit 2bb417bfff
5 changed files with 7 additions and 7 deletions

View File

@ -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 // 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 { 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...) getOpts = append(getOpts, opts...)
resp, err := client.Get(ctx, key, getOpts...) resp, err := client.Get(ctx, key, getOpts...)
maxRev := int64(math.MaxInt64) maxRev := int64(math.MaxInt64)

View File

@ -148,11 +148,11 @@ func TestKVRange(t *testing.T) {
{Key: []byte("fop"), Value: nil, CreateRevision: 9, ModRevision: 9, Version: 1}, {Key: []byte("fop"), Value: nil, CreateRevision: 9, ModRevision: 9, Version: 1},
}, },
}, },
// range all with SortByCreatedRev, SortDescend // range all with SortByCreateRevision, SortDescend
{ {
"a", "x", "a", "x",
0, 0,
[]clientv3.OpOption{clientv3.WithSort(clientv3.SortByCreatedRev, clientv3.SortDescend)}, []clientv3.OpOption{clientv3.WithSort(clientv3.SortByCreateRevision, clientv3.SortDescend)},
[]*storagepb.KeyValue{ []*storagepb.KeyValue{
{Key: []byte("fop"), Value: nil, CreateRevision: 9, ModRevision: 9, Version: 1}, {Key: []byte("fop"), Value: nil, CreateRevision: 9, ModRevision: 9, Version: 1},

View File

@ -209,10 +209,10 @@ func WithSerializable() OpOption {
} }
// WithFirstCreate gets the key with the oldest creation revision in the request range. // 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. // 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. // WithFirstKey gets the lexically first key in the request range.
func WithFirstKey() []OpOption { return withTop(SortByKey, SortAscend) } func WithFirstKey() []OpOption { return withTop(SortByKey, SortAscend) }

View File

@ -26,7 +26,7 @@ const (
const ( const (
SortByKey SortTarget = iota SortByKey SortTarget = iota
SortByVersion SortByVersion
SortByCreatedRev SortByCreateRevision
SortByModRevision SortByModRevision
SortByValue SortByValue
) )

View File

@ -96,7 +96,7 @@ func getGetOp(cmd *cobra.Command, args []string) (string, []clientv3.OpOption) {
sortTarget := strings.ToUpper(getSortTarget) sortTarget := strings.ToUpper(getSortTarget)
switch { switch {
case sortTarget == "CREATE": case sortTarget == "CREATE":
sortByTarget = clientv3.SortByCreatedRev sortByTarget = clientv3.SortByCreateRevision
case sortTarget == "KEY": case sortTarget == "KEY":
sortByTarget = clientv3.SortByKey sortByTarget = clientv3.SortByKey
case sortTarget == "MODIFY": case sortTarget == "MODIFY":