From 489779d905e86494fea1d81168e079fa41a4e1f6 Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Wed, 23 Mar 2016 09:40:16 -0700 Subject: [PATCH] clientv3: rename comparison from CreatedRevision to CreateRevision To match protobuf naming --- clientv3/compare.go | 2 +- clientv3/concurrency/election.go | 2 +- clientv3/concurrency/mutex.go | 2 +- clientv3/txn_test.go | 2 +- etcdctlv3/command/txn_command.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/clientv3/compare.go b/clientv3/compare.go index 7e6f4e2ce..d74db7795 100644 --- a/clientv3/compare.go +++ b/clientv3/compare.go @@ -72,7 +72,7 @@ func Version(key string) Cmp { return Cmp{Key: []byte(key), Target: pb.Compare_VERSION} } -func CreatedRevision(key string) Cmp { +func CreateRevision(key string) Cmp { return Cmp{Key: []byte(key), Target: pb.Compare_CREATE} } diff --git a/clientv3/concurrency/election.go b/clientv3/concurrency/election.go index d74d19be4..991bd2628 100644 --- a/clientv3/concurrency/election.go +++ b/clientv3/concurrency/election.go @@ -74,7 +74,7 @@ func (e *Election) Proclaim(ctx context.Context, val string) error { if e.leaderSession == nil { return ErrElectionNotLeader } - cmp := v3.Compare(v3.CreatedRevision(e.leaderKey), "=", e.leaderRev) + cmp := v3.Compare(v3.CreateRevision(e.leaderKey), "=", e.leaderRev) txn := e.client.Txn(ctx).If(cmp) txn = txn.Then(v3.OpPut(e.leaderKey, val, v3.WithLease(e.leaderSession.Lease()))) tresp, terr := txn.Commit() diff --git a/clientv3/concurrency/mutex.go b/clientv3/concurrency/mutex.go index b378058ee..8ea8acd52 100644 --- a/clientv3/concurrency/mutex.go +++ b/clientv3/concurrency/mutex.go @@ -64,7 +64,7 @@ func (m *Mutex) Unlock() error { } func (m *Mutex) IsOwner() v3.Cmp { - return v3.Compare(v3.CreatedRevision(m.myKey), "=", m.myRev) + return v3.Compare(v3.CreateRevision(m.myKey), "=", m.myRev) } func (m *Mutex) Key() string { return m.myKey } diff --git a/clientv3/txn_test.go b/clientv3/txn_test.go index ac7a7f67c..24fe068e2 100644 --- a/clientv3/txn_test.go +++ b/clientv3/txn_test.go @@ -33,7 +33,7 @@ func TestTxnPanics(t *testing.T) { } } - cmp := Compare(CreatedRevision("foo"), "=", 0) + cmp := Compare(CreateRevision("foo"), "=", 0) op := OpPut("foo", "bar") tests := []struct { diff --git a/etcdctlv3/command/txn_command.go b/etcdctlv3/command/txn_command.go index 543966fc1..c972ed80f 100644 --- a/etcdctlv3/command/txn_command.go +++ b/etcdctlv3/command/txn_command.go @@ -183,7 +183,7 @@ func parseCompare(line string) (*clientv3.Cmp, error) { } case "c", "create": if v, err = strconv.ParseInt(val, 10, 64); err == nil { - cmp = clientv3.Compare(clientv3.CreatedRevision(key), op, v) + cmp = clientv3.Compare(clientv3.CreateRevision(key), op, v) } case "m", "mod": if v, err = strconv.ParseInt(val, 10, 64); err == nil {