mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
clientv3: rename comparison from CreatedRevision to CreateRevision
To match protobuf naming
This commit is contained in:
parent
88e738fcb6
commit
489779d905
@ -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}
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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 }
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user