clientv3: rename comparison from CreatedRevision to CreateRevision

To match protobuf naming
This commit is contained in:
Anthony Romano 2016-03-23 09:40:16 -07:00
parent 88e738fcb6
commit 489779d905
5 changed files with 5 additions and 5 deletions

View File

@ -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}
}

View File

@ -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()

View File

@ -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 }

View File

@ -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 {

View File

@ -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 {