mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
*: regenerate proto to use local import path
Using Go-style import paths in protos is not idiomatic. Normally, this detail would be internal to etcd, but the path from which gogoproto is imported affects downstream consumers (e.g. cockroachdb). In cockroach, we want to avoid including `$GOPATH/src` in our protoc include path for various reasons. This patch puts etcd on the same convention, which allows this for cockroach. More information: https://github.com/cockroachdb/cockroach/pull/2339#discussion_r38663417 This commit also regenerates all the protos, which seem to have drifted a tiny bit.
This commit is contained in:
parent
1eaf169057
commit
45390b9fb8
@ -19,7 +19,7 @@ package etcdserverpb
|
|||||||
import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
|
import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
|
||||||
import math "math"
|
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 io "io"
|
||||||
import fmt "fmt"
|
import fmt "fmt"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
syntax = "proto2";
|
syntax = "proto2";
|
||||||
package etcdserverpb;
|
package etcdserverpb;
|
||||||
|
|
||||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
import "gogoproto/gogo.proto";
|
||||||
|
|
||||||
option (gogoproto.marshaler_all) = true;
|
option (gogoproto.marshaler_all) = true;
|
||||||
option (gogoproto.sizer_all) = true;
|
option (gogoproto.sizer_all) = true;
|
||||||
|
@ -6,7 +6,7 @@ package etcdserverpb
|
|||||||
|
|
||||||
import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
|
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 io "io"
|
||||||
import fmt "fmt"
|
import fmt "fmt"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package etcdserverpb;
|
package etcdserverpb;
|
||||||
|
|
||||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
import "gogoproto/gogo.proto";
|
||||||
import "etcdserver.proto";
|
import "etcdserver.proto";
|
||||||
import "rpc.proto";
|
import "rpc.proto";
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ package etcdserverpb
|
|||||||
|
|
||||||
import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
|
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 storagepb "github.com/coreos/etcd/storage/storagepb"
|
||||||
|
|
||||||
import io "io"
|
import io "io"
|
||||||
@ -108,6 +108,8 @@ type RangeResponse struct {
|
|||||||
Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
|
Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
|
||||||
Kvs []*storagepb.KeyValue `protobuf:"bytes,2,rep,name=kvs" json:"kvs,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"`
|
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{} }
|
func (m *RangeResponse) Reset() { *m = RangeResponse{} }
|
||||||
@ -329,6 +331,10 @@ func (m *TxnResponse) GetResponses() []*ResponseUnion {
|
|||||||
return nil
|
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 {
|
type CompactionRequest struct {
|
||||||
Index int64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
|
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]...)
|
m.ConsistentToken = append([]byte{}, data[iNdEx:postIndex]...)
|
||||||
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:
|
default:
|
||||||
var sizeOfWire int
|
var sizeOfWire int
|
||||||
for {
|
for {
|
||||||
@ -1942,6 +1965,9 @@ func (m *RangeResponse) Size() (n int) {
|
|||||||
n += 1 + l + sovRpc(uint64(l))
|
n += 1 + l + sovRpc(uint64(l))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if m.More {
|
||||||
|
n += 2
|
||||||
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2281,6 +2307,16 @@ func (m *RangeResponse) MarshalTo(data []byte) (n int, err error) {
|
|||||||
i += copy(data[i:], m.ConsistentToken)
|
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
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package etcdserverpb;
|
package etcdserverpb;
|
||||||
|
|
||||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
import "gogoproto/gogo.proto";
|
||||||
import "github.com/coreos/etcd/storage/storagepb/kv.proto";
|
import "etcd/storage/storagepb/kv.proto";
|
||||||
|
|
||||||
option (gogoproto.marshaler_all) = true;
|
option (gogoproto.marshaler_all) = true;
|
||||||
option (gogoproto.unmarshaler_all) = true;
|
option (gogoproto.unmarshaler_all) = true;
|
||||||
|
@ -22,7 +22,7 @@ package raftpb
|
|||||||
import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
|
import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
|
||||||
import math "math"
|
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 io "io"
|
||||||
import fmt "fmt"
|
import fmt "fmt"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
syntax = "proto2";
|
syntax = "proto2";
|
||||||
package raftpb;
|
package raftpb;
|
||||||
|
|
||||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
import "gogoproto/gogo.proto";
|
||||||
|
|
||||||
option (gogoproto.marshaler_all) = true;
|
option (gogoproto.marshaler_all) = true;
|
||||||
option (gogoproto.sizer_all) = true;
|
option (gogoproto.sizer_all) = true;
|
||||||
|
@ -22,7 +22,7 @@ export GOBIN=${PWD}/bin
|
|||||||
go get github.com/gogo/protobuf/{proto,protoc-gen-gogo,gogoproto}
|
go get github.com/gogo/protobuf/{proto,protoc-gen-gogo,gogoproto}
|
||||||
pushd ${GOPATH}/src/github.com/gogo/protobuf/
|
pushd ${GOPATH}/src/github.com/gogo/protobuf/
|
||||||
git reset --hard ${SHA}
|
git reset --hard ${SHA}
|
||||||
make
|
make install
|
||||||
popd
|
popd
|
||||||
|
|
||||||
export PATH="${GOBIN}:${PATH}"
|
export PATH="${GOBIN}:${PATH}"
|
||||||
@ -35,10 +35,17 @@ for dir in ${DIRS}; do
|
|||||||
popd
|
popd
|
||||||
done
|
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
|
for dir in ${DIRS}; do
|
||||||
pushd ${dir}
|
pushd ${dir}
|
||||||
protoc --gogofast_out=plugins=grpc:. -I=.:${GOPATH}/src/github.com/gogo/protobuf/protobuf:${GOPATH}/src *.proto
|
protoc --gogofast_out=plugins=grpc,import_prefix=github.com/coreos/:. -I=.:"${GOGOPROTO_PATH}":"${COREOS_ROOT}" *.proto
|
||||||
sed -i".bak" -e "s|github.com/gogo/protobuf/proto|${PREFIX}/github.com/gogo/protobuf/proto|" *.go
|
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
|
rm -f *.bak
|
||||||
popd
|
popd
|
||||||
done
|
done
|
||||||
|
@ -16,7 +16,7 @@ package snappb
|
|||||||
import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
|
import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
|
||||||
import math "math"
|
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 io "io"
|
||||||
import fmt "fmt"
|
import fmt "fmt"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
syntax = "proto2";
|
syntax = "proto2";
|
||||||
package snappb;
|
package snappb;
|
||||||
|
|
||||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
import "gogoproto/gogo.proto";
|
||||||
|
|
||||||
option (gogoproto.marshaler_all) = true;
|
option (gogoproto.marshaler_all) = true;
|
||||||
option (gogoproto.sizer_all) = true;
|
option (gogoproto.sizer_all) = true;
|
||||||
|
@ -16,7 +16,7 @@ package storagepb
|
|||||||
|
|
||||||
import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
|
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 io "io"
|
||||||
import fmt "fmt"
|
import fmt "fmt"
|
||||||
@ -49,8 +49,8 @@ func (x Event_EventType) String() string {
|
|||||||
|
|
||||||
type KeyValue struct {
|
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"`
|
||||||
// mod_index is the last modified index of the key.
|
|
||||||
CreateIndex int64 `protobuf:"varint,2,opt,name=create_index,proto3" json:"create_index,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.
|
||||||
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
|
// version is the version of the key. A deletion resets
|
||||||
// the version to zero and any modification of the key
|
// the version to zero and any modification of the key
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package storagepb;
|
package storagepb;
|
||||||
|
|
||||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
import "gogoproto/gogo.proto";
|
||||||
|
|
||||||
option (gogoproto.marshaler_all) = true;
|
option (gogoproto.marshaler_all) = true;
|
||||||
option (gogoproto.sizer_all) = true;
|
option (gogoproto.sizer_all) = true;
|
||||||
|
@ -17,7 +17,7 @@ package walpb
|
|||||||
import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
|
import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
|
||||||
import math "math"
|
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 io "io"
|
||||||
import fmt "fmt"
|
import fmt "fmt"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
syntax = "proto2";
|
syntax = "proto2";
|
||||||
package walpb;
|
package walpb;
|
||||||
|
|
||||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
import "gogoproto/gogo.proto";
|
||||||
|
|
||||||
option (gogoproto.marshaler_all) = true;
|
option (gogoproto.marshaler_all) = true;
|
||||||
option (gogoproto.sizer_all) = true;
|
option (gogoproto.sizer_all) = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user