Browse Source

Merge pull request #3433 from tamird/proto-import-path

*: regenerate proto to use local import path
Xiang Li 10 years ago
parent
commit
ae2b43b588

+ 1 - 1
etcdserver/etcdserverpb/etcdserver.pb.go

@@ -19,7 +19,7 @@ package etcdserverpb
 import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
 import math "math"
 
-// discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto/gogo.pb"
+// discarding unused import gogoproto "github.com/coreos/etcd/Godeps/_workspace/src/gogoproto/gogo.pb"
 
 import io "io"
 import fmt "fmt"

+ 1 - 1
etcdserver/etcdserverpb/etcdserver.proto

@@ -1,7 +1,7 @@
 syntax = "proto2";
 package etcdserverpb;
 
-import "github.com/gogo/protobuf/gogoproto/gogo.proto";
+import "gogoproto/gogo.proto";
 
 option (gogoproto.marshaler_all) = true;
 option (gogoproto.sizer_all) = true;

+ 1 - 1
etcdserver/etcdserverpb/raft_internal.pb.go

@@ -6,7 +6,7 @@ package etcdserverpb
 
 import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
 
-// discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto/gogo.pb"
+// discarding unused import gogoproto "github.com/coreos/etcd/Godeps/_workspace/src/gogoproto/gogo.pb"
 
 import io "io"
 import fmt "fmt"

+ 1 - 1
etcdserver/etcdserverpb/raft_internal.proto

@@ -1,7 +1,7 @@
 syntax = "proto3";
 package etcdserverpb;
 
-import "github.com/gogo/protobuf/gogoproto/gogo.proto";
+import "gogoproto/gogo.proto";
 import "etcdserver.proto";
 import "rpc.proto";
 

+ 37 - 1
etcdserver/etcdserverpb/rpc.pb.go

@@ -6,7 +6,7 @@ package etcdserverpb
 
 import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
 
-// discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto/gogo.pb"
+// discarding unused import gogoproto "github.com/coreos/etcd/Godeps/_workspace/src/gogoproto/gogo.pb"
 import storagepb "github.com/coreos/etcd/storage/storagepb"
 
 import io "io"
@@ -108,6 +108,8 @@ type RangeResponse struct {
 	Header          *ResponseHeader       `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
 	Kvs             []*storagepb.KeyValue `protobuf:"bytes,2,rep,name=kvs" json:"kvs,omitempty"`
 	ConsistentToken []byte                `protobuf:"bytes,3,opt,name=consistent_token,proto3" json:"consistent_token,omitempty"`
+	// more indicates if there are more keys to return in the requested range.
+	More bool `protobuf:"varint,4,opt,name=more,proto3" json:"more,omitempty"`
 }
 
 func (m *RangeResponse) Reset()         { *m = RangeResponse{} }
@@ -329,6 +331,10 @@ func (m *TxnResponse) GetResponses() []*ResponseUnion {
 	return nil
 }
 
+// Compaction compacts the kv store upto the given index (including).
+// It removes the old versions of a key. It keeps the newest version of
+// the key even if its latest modification index is smaller than the given
+// index.
 type CompactionRequest struct {
 	Index int64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
 }
@@ -696,6 +702,23 @@ func (m *RangeResponse) Unmarshal(data []byte) error {
 			}
 			m.ConsistentToken = append([]byte{}, data[iNdEx:postIndex]...)
 			iNdEx = postIndex
+		case 4:
+			if wireType != 0 {
+				return fmt.Errorf("proto: wrong wireType = %d for field More", wireType)
+			}
+			var v int
+			for shift := uint(0); ; shift += 7 {
+				if iNdEx >= l {
+					return io.ErrUnexpectedEOF
+				}
+				b := data[iNdEx]
+				iNdEx++
+				v |= (int(b) & 0x7F) << shift
+				if b < 0x80 {
+					break
+				}
+			}
+			m.More = bool(v != 0)
 		default:
 			var sizeOfWire int
 			for {
@@ -1942,6 +1965,9 @@ func (m *RangeResponse) Size() (n int) {
 			n += 1 + l + sovRpc(uint64(l))
 		}
 	}
+	if m.More {
+		n += 2
+	}
 	return n
 }
 
@@ -2281,6 +2307,16 @@ func (m *RangeResponse) MarshalTo(data []byte) (n int, err error) {
 			i += copy(data[i:], m.ConsistentToken)
 		}
 	}
+	if m.More {
+		data[i] = 0x20
+		i++
+		if m.More {
+			data[i] = 1
+		} else {
+			data[i] = 0
+		}
+		i++
+	}
 	return i, nil
 }
 

+ 8 - 8
etcdserver/etcdserverpb/rpc.proto

@@ -1,8 +1,8 @@
 syntax = "proto3";
 package etcdserverpb;
 
-import "github.com/gogo/protobuf/gogoproto/gogo.proto";
-import "github.com/coreos/etcd/storage/storagepb/kv.proto";
+import "gogoproto/gogo.proto";
+import "etcd/storage/storagepb/kv.proto";
 
 option (gogoproto.marshaler_all) = true;
 option (gogoproto.unmarshaler_all) = true;
@@ -50,7 +50,7 @@ message RangeRequest {
   bytes range_end = 2;
   // limit the number of keys returned.
   int64 limit = 3;
-  // the response will be consistent with previous request with same token if the token is 
+  // the response will be consistent with previous request with same token if the token is
   // given and is valid.
   bytes consistent_token = 4;
 }
@@ -127,9 +127,9 @@ message Compare {
   }
 }
 
-// If the comparisons succeed, then the success requests will be processed in order, 
+// If the comparisons succeed, then the success requests will be processed in order,
 // and the response will contain their respective responses in order.
-// If the comparisons fail, then the failure requests will be processed in order, 
+// If the comparisons fail, then the failure requests will be processed in order,
 // and the response will contain their respective responses in order.
 
 // From google paxosdb paper:
@@ -159,9 +159,9 @@ message TxnResponse {
   repeated ResponseUnion responses = 3;
 }
 
-// Compaction compacts the kv store upto the given index (including). 
-// It removes the old versions of a key. It keeps the newest version of 
-// the key even if its latest modification index is smaller than the given 
+// Compaction compacts the kv store upto the given index (including).
+// It removes the old versions of a key. It keeps the newest version of
+// the key even if its latest modification index is smaller than the given
 // index.
 message CompactionRequest {
   int64 index = 1;

+ 1 - 1
raft/raftpb/raft.pb.go

@@ -22,7 +22,7 @@ package raftpb
 import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
 import math "math"
 
-// discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto/gogo.pb"
+// discarding unused import gogoproto "github.com/coreos/etcd/Godeps/_workspace/src/gogoproto/gogo.pb"
 
 import io "io"
 import fmt "fmt"

+ 1 - 1
raft/raftpb/raft.proto

@@ -1,7 +1,7 @@
 syntax = "proto2";
 package raftpb;
 
-import "github.com/gogo/protobuf/gogoproto/gogo.proto";
+import "gogoproto/gogo.proto";
 
 option (gogoproto.marshaler_all) = true;
 option (gogoproto.sizer_all) = true;

+ 10 - 3
scripts/genproto.sh

@@ -22,7 +22,7 @@ export GOBIN=${PWD}/bin
 go get github.com/gogo/protobuf/{proto,protoc-gen-gogo,gogoproto}
 pushd ${GOPATH}/src/github.com/gogo/protobuf/
 	git reset --hard ${SHA}
-	make
+	make install
 popd
 
 export PATH="${GOBIN}:${PATH}"
@@ -35,10 +35,17 @@ for dir in ${DIRS}; do
 	popd
 done
 
+COREOS_ROOT="${GOPATH}/src/github.com/coreos"
+GOGOPROTO_ROOT="${GOPATH}/src/github.com/gogo/protobuf"
+GOGOPROTO_PATH="${GOGOPROTO_ROOT}:${GOGOPROTO_ROOT}/protobuf"
+
+ESCAPED_PREFIX=$(echo $PREFIX | sed -e 's/[\/&]/\\&/g')
+
 for dir in ${DIRS}; do
 	pushd ${dir}
-		protoc --gogofast_out=plugins=grpc:. -I=.:${GOPATH}/src/github.com/gogo/protobuf/protobuf:${GOPATH}/src *.proto
-		sed -i".bak" -e "s|github.com/gogo/protobuf/proto|${PREFIX}/github.com/gogo/protobuf/proto|" *.go
+		protoc --gogofast_out=plugins=grpc,import_prefix=github.com/coreos/:. -I=.:"${GOGOPROTO_PATH}":"${COREOS_ROOT}" *.proto
+		sed -i.bak -E "s/github\.com\/coreos\/(gogoproto|github\.com|golang\.org|google\.golang\.org)/${ESCAPED_PREFIX}\/\1/g" *.pb.go
+		sed -i.bak -E 's/github\.com\/coreos\/(errors|fmt|io)/\1/g' *.pb.go
 		rm -f *.bak
 	popd
 done

+ 1 - 1
snap/snappb/snap.pb.go

@@ -16,7 +16,7 @@ package snappb
 import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
 import math "math"
 
-// discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto/gogo.pb"
+// discarding unused import gogoproto "github.com/coreos/etcd/Godeps/_workspace/src/gogoproto/gogo.pb"
 
 import io "io"
 import fmt "fmt"

+ 1 - 1
snap/snappb/snap.proto

@@ -1,7 +1,7 @@
 syntax = "proto2";
 package snappb;
 
-import "github.com/gogo/protobuf/gogoproto/gogo.proto";
+import "gogoproto/gogo.proto";
 
 option (gogoproto.marshaler_all) = true;
 option (gogoproto.sizer_all) = true;

+ 4 - 4
storage/storagepb/kv.pb.go

@@ -16,7 +16,7 @@ package storagepb
 
 import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
 
-// discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto/gogo.pb"
+// discarding unused import gogoproto "github.com/coreos/etcd/Godeps/_workspace/src/gogoproto/gogo.pb"
 
 import io "io"
 import fmt "fmt"
@@ -48,10 +48,10 @@ func (x Event_EventType) String() string {
 }
 
 type KeyValue struct {
-	Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
+	Key         []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
+	CreateIndex int64  `protobuf:"varint,2,opt,name=create_index,proto3" json:"create_index,omitempty"`
 	// mod_index is the last modified index of the key.
-	CreateIndex int64 `protobuf:"varint,2,opt,name=create_index,proto3" json:"create_index,omitempty"`
-	ModIndex    int64 `protobuf:"varint,3,opt,name=mod_index,proto3" json:"mod_index,omitempty"`
+	ModIndex int64 `protobuf:"varint,3,opt,name=mod_index,proto3" json:"mod_index,omitempty"`
 	// version is the version of the key. A deletion resets
 	// the version to zero and any modification of the key
 	// increases its version.

+ 1 - 1
storage/storagepb/kv.proto

@@ -1,7 +1,7 @@
 syntax = "proto3";
 package storagepb;
 
-import "github.com/gogo/protobuf/gogoproto/gogo.proto";
+import "gogoproto/gogo.proto";
 
 option (gogoproto.marshaler_all) = true;
 option (gogoproto.sizer_all) = true;

+ 1 - 1
wal/walpb/record.pb.go

@@ -17,7 +17,7 @@ package walpb
 import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
 import math "math"
 
-// discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto/gogo.pb"
+// discarding unused import gogoproto "github.com/coreos/etcd/Godeps/_workspace/src/gogoproto/gogo.pb"
 
 import io "io"
 import fmt "fmt"

+ 1 - 1
wal/walpb/record.proto

@@ -1,7 +1,7 @@
 syntax = "proto2";
 package walpb;
 
-import "github.com/gogo/protobuf/gogoproto/gogo.proto";
+import "gogoproto/gogo.proto";
 
 option (gogoproto.marshaler_all) = true;
 option (gogoproto.sizer_all) = true;