From 1e4d3603db649f182877ea23ef5ca91f37045fa5 Mon Sep 17 00:00:00 2001 From: Gyu-Ho Lee Date: Tue, 7 Jun 2016 13:32:36 -0700 Subject: [PATCH] clientv3,ctlv3: following changes for proto change --- clientv3/op.go | 8 ++++---- clientv3/txn.go | 8 ++++---- etcdctl/ctlv3/command/printer.go | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/clientv3/op.go b/clientv3/op.go index 2b8c1d87a..616e68abd 100644 --- a/clientv3/op.go +++ b/clientv3/op.go @@ -53,7 +53,7 @@ type Op struct { leaseID LeaseID } -func (op Op) toRequestUnion() *pb.RequestUnion { +func (op Op) toRequestOp() *pb.RequestOp { switch op.t { case tRange: r := &pb.RangeRequest{Key: op.key, RangeEnd: op.end, Limit: op.limit, Revision: op.rev, Serializable: op.serializable} @@ -61,13 +61,13 @@ func (op Op) toRequestUnion() *pb.RequestUnion { r.SortOrder = pb.RangeRequest_SortOrder(op.sort.Order) r.SortTarget = pb.RangeRequest_SortTarget(op.sort.Target) } - return &pb.RequestUnion{Request: &pb.RequestUnion_RequestRange{RequestRange: r}} + return &pb.RequestOp{Request: &pb.RequestOp_RequestRange{RequestRange: r}} case tPut: r := &pb.PutRequest{Key: op.key, Value: op.val, Lease: int64(op.leaseID)} - return &pb.RequestUnion{Request: &pb.RequestUnion_RequestPut{RequestPut: r}} + return &pb.RequestOp{Request: &pb.RequestOp_RequestPut{RequestPut: r}} case tDeleteRange: r := &pb.DeleteRangeRequest{Key: op.key, RangeEnd: op.end} - return &pb.RequestUnion{Request: &pb.RequestUnion_RequestDeleteRange{RequestDeleteRange: r}} + return &pb.RequestOp{Request: &pb.RequestOp_RequestDeleteRange{RequestDeleteRange: r}} default: panic("Unknown Op") } diff --git a/clientv3/txn.go b/clientv3/txn.go index d08a46eb8..77e7642ca 100644 --- a/clientv3/txn.go +++ b/clientv3/txn.go @@ -66,8 +66,8 @@ type txn struct { cmps []*pb.Compare - sus []*pb.RequestUnion - fas []*pb.RequestUnion + sus []*pb.RequestOp + fas []*pb.RequestOp } func (txn *txn) If(cs ...Cmp) Txn { @@ -110,7 +110,7 @@ func (txn *txn) Then(ops ...Op) Txn { for _, op := range ops { txn.isWrite = txn.isWrite || op.isWrite() - txn.sus = append(txn.sus, op.toRequestUnion()) + txn.sus = append(txn.sus, op.toRequestOp()) } return txn @@ -128,7 +128,7 @@ func (txn *txn) Else(ops ...Op) Txn { for _, op := range ops { txn.isWrite = txn.isWrite || op.isWrite() - txn.fas = append(txn.fas, op.toRequestUnion()) + txn.fas = append(txn.fas, op.toRequestOp()) } return txn diff --git a/etcdctl/ctlv3/command/printer.go b/etcdctl/ctlv3/command/printer.go index 17b3aea9f..e69deecc3 100644 --- a/etcdctl/ctlv3/command/printer.go +++ b/etcdctl/ctlv3/command/printer.go @@ -128,11 +128,11 @@ func (s *simplePrinter) Txn(resp v3.TxnResponse) { for _, r := range resp.Responses { fmt.Println("") switch v := r.Response.(type) { - case *pb.ResponseUnion_ResponseDeleteRange: + case *pb.ResponseOp_ResponseDeleteRange: s.Del((v3.DeleteResponse)(*v.ResponseDeleteRange)) - case *pb.ResponseUnion_ResponsePut: + case *pb.ResponseOp_ResponsePut: s.Put((v3.PutResponse)(*v.ResponsePut)) - case *pb.ResponseUnion_ResponseRange: + case *pb.ResponseOp_ResponseRange: s.Get(((v3.GetResponse)(*v.ResponseRange))) default: fmt.Printf("unexpected response %+v\n", r)