Browse Source

clientv3: rename comparison from CreatedRevision to CreateRevision

To match protobuf naming
Anthony Romano 9 years ago
parent
commit
489779d905

+ 1 - 1
clientv3/compare.go

@@ -72,7 +72,7 @@ func Version(key string) Cmp {
 	return Cmp{Key: []byte(key), Target: pb.Compare_VERSION}
 	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}
 	return Cmp{Key: []byte(key), Target: pb.Compare_CREATE}
 }
 }
 
 

+ 1 - 1
clientv3/concurrency/election.go

@@ -74,7 +74,7 @@ func (e *Election) Proclaim(ctx context.Context, val string) error {
 	if e.leaderSession == nil {
 	if e.leaderSession == nil {
 		return ErrElectionNotLeader
 		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 := e.client.Txn(ctx).If(cmp)
 	txn = txn.Then(v3.OpPut(e.leaderKey, val, v3.WithLease(e.leaderSession.Lease())))
 	txn = txn.Then(v3.OpPut(e.leaderKey, val, v3.WithLease(e.leaderSession.Lease())))
 	tresp, terr := txn.Commit()
 	tresp, terr := txn.Commit()

+ 1 - 1
clientv3/concurrency/mutex.go

@@ -64,7 +64,7 @@ func (m *Mutex) Unlock() error {
 }
 }
 
 
 func (m *Mutex) IsOwner() v3.Cmp {
 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 }
 func (m *Mutex) Key() string { return m.myKey }

+ 1 - 1
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")
 	op := OpPut("foo", "bar")
 
 
 	tests := []struct {
 	tests := []struct {

+ 1 - 1
etcdctlv3/command/txn_command.go

@@ -183,7 +183,7 @@ func parseCompare(line string) (*clientv3.Cmp, error) {
 		}
 		}
 	case "c", "create":
 	case "c", "create":
 		if v, err = strconv.ParseInt(val, 10, 64); err == nil {
 		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":
 	case "m", "mod":
 		if v, err = strconv.ParseInt(val, 10, 64); err == nil {
 		if v, err = strconv.ParseInt(val, 10, 64); err == nil {