Merge pull request #3394 from krasi-georgiev/gogo-vs-golang-protobuf
replace golang/protobuf with gogo/protobuf
This commit is contained in:
commit
7ff9ea9ae3
2
NOTICE
2
NOTICE
|
@ -52,7 +52,7 @@ Copyright jQuery Foundation and other contributors
|
||||||
Licensed under the MIT License
|
Licensed under the MIT License
|
||||||
|
|
||||||
Go support for Protocol Buffers - Google's data interchange format
|
Go support for Protocol Buffers - Google's data interchange format
|
||||||
http://github.com/golang/protobuf/
|
http://github.com/gogo/protobuf/
|
||||||
Copyright 2010 The Go Authors
|
Copyright 2010 The Go Authors
|
||||||
See source code for license details.
|
See source code for license details.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"swagger": "2.0",
|
"swagger": "2.0",
|
||||||
"info": {
|
"info": {
|
||||||
"title": "prompb/rpc.proto",
|
"title": "rpc.proto",
|
||||||
"version": "version not set"
|
"version": "version not set"
|
||||||
},
|
},
|
||||||
"schemes": [
|
"schemes": [
|
||||||
|
|
|
@ -18,7 +18,7 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/gogo/protobuf/proto"
|
||||||
"github.com/golang/snappy"
|
"github.com/golang/snappy"
|
||||||
"github.com/prometheus/common/model"
|
"github.com/prometheus/common/model"
|
||||||
|
|
||||||
|
|
|
@ -308,24 +308,6 @@ func (m *QueryResult) MarshalTo(dAtA []byte) (int, error) {
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeFixed64Remote(dAtA []byte, offset int, v uint64) int {
|
|
||||||
dAtA[offset] = uint8(v)
|
|
||||||
dAtA[offset+1] = uint8(v >> 8)
|
|
||||||
dAtA[offset+2] = uint8(v >> 16)
|
|
||||||
dAtA[offset+3] = uint8(v >> 24)
|
|
||||||
dAtA[offset+4] = uint8(v >> 32)
|
|
||||||
dAtA[offset+5] = uint8(v >> 40)
|
|
||||||
dAtA[offset+6] = uint8(v >> 48)
|
|
||||||
dAtA[offset+7] = uint8(v >> 56)
|
|
||||||
return offset + 8
|
|
||||||
}
|
|
||||||
func encodeFixed32Remote(dAtA []byte, offset int, v uint32) int {
|
|
||||||
dAtA[offset] = uint8(v)
|
|
||||||
dAtA[offset+1] = uint8(v >> 8)
|
|
||||||
dAtA[offset+2] = uint8(v >> 16)
|
|
||||||
dAtA[offset+3] = uint8(v >> 24)
|
|
||||||
return offset + 4
|
|
||||||
}
|
|
||||||
func encodeVarintRemote(dAtA []byte, offset int, v uint64) int {
|
func encodeVarintRemote(dAtA []byte, offset int, v uint64) int {
|
||||||
for v >= 1<<7 {
|
for v >= 1<<7 {
|
||||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||||
|
|
|
@ -1,25 +1,6 @@
|
||||||
// Code generated by protoc-gen-gogo.
|
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||||
// source: rpc.proto
|
// source: rpc.proto
|
||||||
// DO NOT EDIT!
|
|
||||||
|
|
||||||
/*
|
|
||||||
Package prompb is a generated protocol buffer package.
|
|
||||||
|
|
||||||
It is generated from these files:
|
|
||||||
rpc.proto
|
|
||||||
types.proto
|
|
||||||
|
|
||||||
It has these top-level messages:
|
|
||||||
TSDBSnapshotRequest
|
|
||||||
TSDBSnapshotResponse
|
|
||||||
SeriesDeleteRequest
|
|
||||||
SeriesDeleteResponse
|
|
||||||
Sample
|
|
||||||
TimeSeries
|
|
||||||
Label
|
|
||||||
Labels
|
|
||||||
LabelMatcher
|
|
||||||
*/
|
|
||||||
package prompb
|
package prompb
|
||||||
|
|
||||||
import proto "github.com/gogo/protobuf/proto"
|
import proto "github.com/gogo/protobuf/proto"
|
||||||
|
@ -45,12 +26,6 @@ var _ = fmt.Errorf
|
||||||
var _ = math.Inf
|
var _ = math.Inf
|
||||||
var _ = time.Kitchen
|
var _ = time.Kitchen
|
||||||
|
|
||||||
// This is a compile-time assertion to ensure that this generated file
|
|
||||||
// is compatible with the proto package it is being compiled against.
|
|
||||||
// A compilation error at this line likely means your copy of the
|
|
||||||
// proto package needs to be updated.
|
|
||||||
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
|
||||||
|
|
||||||
type TSDBSnapshotRequest struct {
|
type TSDBSnapshotRequest struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,24 +290,6 @@ func (m *SeriesDeleteResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeFixed64Rpc(dAtA []byte, offset int, v uint64) int {
|
|
||||||
dAtA[offset] = uint8(v)
|
|
||||||
dAtA[offset+1] = uint8(v >> 8)
|
|
||||||
dAtA[offset+2] = uint8(v >> 16)
|
|
||||||
dAtA[offset+3] = uint8(v >> 24)
|
|
||||||
dAtA[offset+4] = uint8(v >> 32)
|
|
||||||
dAtA[offset+5] = uint8(v >> 40)
|
|
||||||
dAtA[offset+6] = uint8(v >> 48)
|
|
||||||
dAtA[offset+7] = uint8(v >> 56)
|
|
||||||
return offset + 8
|
|
||||||
}
|
|
||||||
func encodeFixed32Rpc(dAtA []byte, offset int, v uint32) int {
|
|
||||||
dAtA[offset] = uint8(v)
|
|
||||||
dAtA[offset+1] = uint8(v >> 8)
|
|
||||||
dAtA[offset+2] = uint8(v >> 16)
|
|
||||||
dAtA[offset+3] = uint8(v >> 24)
|
|
||||||
return offset + 4
|
|
||||||
}
|
|
||||||
func encodeVarintRpc(dAtA []byte, offset int, v uint64) int {
|
func encodeVarintRpc(dAtA []byte, offset int, v uint64) int {
|
||||||
for v >= 1<<7 {
|
for v >= 1<<7 {
|
||||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Code generated by protoc-gen-grpc-gateway
|
// Code generated by protoc-gen-grpc-gateway
|
||||||
// source: prompb/rpc.proto
|
// source: rpc.proto
|
||||||
// DO NOT EDIT!
|
// DO NOT EDIT!
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -13,7 +13,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/gogo/protobuf/proto"
|
||||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||||
"github.com/grpc-ecosystem/grpc-gateway/utilities"
|
"github.com/grpc-ecosystem/grpc-gateway/utilities"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Code generated by protoc-gen-gogo.
|
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||||
// source: types.proto
|
// source: types.proto
|
||||||
// DO NOT EDIT!
|
|
||||||
|
|
||||||
package prompb
|
package prompb
|
||||||
|
|
||||||
|
@ -8,6 +7,8 @@ import proto "github.com/gogo/protobuf/proto"
|
||||||
import fmt "fmt"
|
import fmt "fmt"
|
||||||
import math "math"
|
import math "math"
|
||||||
|
|
||||||
|
import encoding_binary "encoding/binary"
|
||||||
|
|
||||||
import io "io"
|
import io "io"
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
@ -189,7 +190,8 @@ func (m *Sample) MarshalTo(dAtA []byte) (int, error) {
|
||||||
if m.Value != 0 {
|
if m.Value != 0 {
|
||||||
dAtA[i] = 0x9
|
dAtA[i] = 0x9
|
||||||
i++
|
i++
|
||||||
i = encodeFixed64Types(dAtA, i, uint64(math.Float64bits(float64(m.Value))))
|
encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value))))
|
||||||
|
i += 8
|
||||||
}
|
}
|
||||||
if m.Timestamp != 0 {
|
if m.Timestamp != 0 {
|
||||||
dAtA[i] = 0x10
|
dAtA[i] = 0x10
|
||||||
|
@ -336,24 +338,6 @@ func (m *LabelMatcher) MarshalTo(dAtA []byte) (int, error) {
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeFixed64Types(dAtA []byte, offset int, v uint64) int {
|
|
||||||
dAtA[offset] = uint8(v)
|
|
||||||
dAtA[offset+1] = uint8(v >> 8)
|
|
||||||
dAtA[offset+2] = uint8(v >> 16)
|
|
||||||
dAtA[offset+3] = uint8(v >> 24)
|
|
||||||
dAtA[offset+4] = uint8(v >> 32)
|
|
||||||
dAtA[offset+5] = uint8(v >> 40)
|
|
||||||
dAtA[offset+6] = uint8(v >> 48)
|
|
||||||
dAtA[offset+7] = uint8(v >> 56)
|
|
||||||
return offset + 8
|
|
||||||
}
|
|
||||||
func encodeFixed32Types(dAtA []byte, offset int, v uint32) int {
|
|
||||||
dAtA[offset] = uint8(v)
|
|
||||||
dAtA[offset+1] = uint8(v >> 8)
|
|
||||||
dAtA[offset+2] = uint8(v >> 16)
|
|
||||||
dAtA[offset+3] = uint8(v >> 24)
|
|
||||||
return offset + 4
|
|
||||||
}
|
|
||||||
func encodeVarintTypes(dAtA []byte, offset int, v uint64) int {
|
func encodeVarintTypes(dAtA []byte, offset int, v uint64) int {
|
||||||
for v >= 1<<7 {
|
for v >= 1<<7 {
|
||||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||||
|
@ -486,15 +470,8 @@ func (m *Sample) Unmarshal(dAtA []byte) error {
|
||||||
if (iNdEx + 8) > l {
|
if (iNdEx + 8) > l {
|
||||||
return io.ErrUnexpectedEOF
|
return io.ErrUnexpectedEOF
|
||||||
}
|
}
|
||||||
|
v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:]))
|
||||||
iNdEx += 8
|
iNdEx += 8
|
||||||
v = uint64(dAtA[iNdEx-8])
|
|
||||||
v |= uint64(dAtA[iNdEx-7]) << 8
|
|
||||||
v |= uint64(dAtA[iNdEx-6]) << 16
|
|
||||||
v |= uint64(dAtA[iNdEx-5]) << 24
|
|
||||||
v |= uint64(dAtA[iNdEx-4]) << 32
|
|
||||||
v |= uint64(dAtA[iNdEx-3]) << 40
|
|
||||||
v |= uint64(dAtA[iNdEx-2]) << 48
|
|
||||||
v |= uint64(dAtA[iNdEx-1]) << 56
|
|
||||||
m.Value = float64(math.Float64frombits(v))
|
m.Value = float64(math.Float64frombits(v))
|
||||||
case 2:
|
case 2:
|
||||||
if wireType != 0 {
|
if wireType != 0 {
|
||||||
|
|
|
@ -31,20 +31,19 @@ for dir in ${DIRS}; do
|
||||||
-I="${GRPC_GATEWAY_ROOT}/third_party/googleapis" \
|
-I="${GRPC_GATEWAY_ROOT}/third_party/googleapis" \
|
||||||
*.proto
|
*.proto
|
||||||
|
|
||||||
|
protoc -I. \
|
||||||
|
-I="${GOGOPROTO_PATH}" \
|
||||||
|
-I="${PROM_PATH}" \
|
||||||
|
-I="${GRPC_GATEWAY_ROOT}/third_party/googleapis" \
|
||||||
|
--grpc-gateway_out=logtostderr=true:. \
|
||||||
|
--swagger_out=logtostderr=true:../documentation/dev/api/ \
|
||||||
|
rpc.proto
|
||||||
|
mv ../documentation/dev/api/rpc.swagger.json ../documentation/dev/api/swagger.json
|
||||||
|
|
||||||
sed -i.bak -E 's/import _ \"gogoproto\"//g' *.pb.go
|
sed -i.bak -E 's/import _ \"gogoproto\"//g' *.pb.go
|
||||||
sed -i.bak -E 's/import _ \"google\/protobuf\"//g' *.pb.go
|
sed -i.bak -E 's/import _ \"google\/protobuf\"//g' *.pb.go
|
||||||
|
sed -i.bak -E 's/golang\/protobuf/gogo\/protobuf/g' *.go
|
||||||
rm -f *.bak
|
rm -f *.bak
|
||||||
goimports -w *.pb.go
|
goimports -w *.pb.go
|
||||||
popd
|
popd
|
||||||
done
|
done
|
||||||
|
|
||||||
protoc -I. \
|
|
||||||
-I="${GOGOPROTO_PATH}" \
|
|
||||||
-I="${PROM_PATH}" \
|
|
||||||
-I="${GRPC_GATEWAY_ROOT}/third_party/googleapis" \
|
|
||||||
--grpc-gateway_out=logtostderr=true:. \
|
|
||||||
--swagger_out=logtostderr=true:./documentation/dev/api/ \
|
|
||||||
prompb/rpc.proto
|
|
||||||
|
|
||||||
mv documentation/dev/api/prompb/rpc.swagger.json documentation/dev/api/swagger.json
|
|
||||||
rm -rf documentation/dev/api/prompb
|
|
|
@ -23,7 +23,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/gogo/protobuf/proto"
|
||||||
"github.com/golang/snappy"
|
"github.com/golang/snappy"
|
||||||
"github.com/prometheus/common/model"
|
"github.com/prometheus/common/model"
|
||||||
"golang.org/x/net/context/ctxhttp"
|
"golang.org/x/net/context/ctxhttp"
|
||||||
|
|
|
@ -94,7 +94,7 @@ func AnnotateContext(ctx context.Context, req *http.Request) (context.Context, e
|
||||||
if len(pairs) == 0 {
|
if len(pairs) == 0 {
|
||||||
return ctx, nil
|
return ctx, nil
|
||||||
}
|
}
|
||||||
return metadata.NewContext(ctx, metadata.Pairs(pairs...)), nil
|
return metadata.NewOutgoingContext(ctx, metadata.Pairs(pairs...)), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ServerMetadata consists of metadata sent from gRPC server.
|
// ServerMetadata consists of metadata sent from gRPC server.
|
||||||
|
|
|
@ -608,25 +608,28 @@
|
||||||
"revisionTime": "2017-06-07T03:48:29Z"
|
"revisionTime": "2017-06-07T03:48:29Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "/SPy/naO5hgJ9w7uWZurcUm2I88=",
|
"checksumSHA1": "InNAv3jGuD6SW4qJDBtGQpj0oRI=",
|
||||||
"origin": "github.com/cockroachdb/cockroach/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime",
|
|
||||||
"path": "github.com/grpc-ecosystem/grpc-gateway/runtime",
|
"path": "github.com/grpc-ecosystem/grpc-gateway/runtime",
|
||||||
"revision": "2ad234c172af14e85f3be9546f6c64c768d4eccd",
|
"revision": "589b126116b5fc961939b3e156c29e4d9d58222f",
|
||||||
"revisionTime": "2017-04-04T23:42:07Z"
|
"revisionTime": "2017-04-17T16:01:37Z",
|
||||||
|
"version": "=v1.2.2",
|
||||||
|
"versionExact": "v1.2.2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "et8uiXNw6yM96U/UZgn2vKtyr3Q=",
|
"checksumSHA1": "et8uiXNw6yM96U/UZgn2vKtyr3Q=",
|
||||||
"origin": "github.com/cockroachdb/cockroach/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/internal",
|
|
||||||
"path": "github.com/grpc-ecosystem/grpc-gateway/runtime/internal",
|
"path": "github.com/grpc-ecosystem/grpc-gateway/runtime/internal",
|
||||||
"revision": "2ad234c172af14e85f3be9546f6c64c768d4eccd",
|
"revision": "589b126116b5fc961939b3e156c29e4d9d58222f",
|
||||||
"revisionTime": "2017-04-04T23:42:07Z"
|
"revisionTime": "2017-04-17T16:01:37Z",
|
||||||
|
"version": "=v1.2.2",
|
||||||
|
"versionExact": "v1.2.2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "vqiK5r5dntV7JNZ+ZsGlD0Samos=",
|
"checksumSHA1": "vqiK5r5dntV7JNZ+ZsGlD0Samos=",
|
||||||
"origin": "github.com/cockroachdb/cockroach/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities",
|
|
||||||
"path": "github.com/grpc-ecosystem/grpc-gateway/utilities",
|
"path": "github.com/grpc-ecosystem/grpc-gateway/utilities",
|
||||||
"revision": "2ad234c172af14e85f3be9546f6c64c768d4eccd",
|
"revision": "589b126116b5fc961939b3e156c29e4d9d58222f",
|
||||||
"revisionTime": "2017-04-04T23:42:07Z"
|
"revisionTime": "2017-04-17T16:01:37Z",
|
||||||
|
"version": "=v1.2.2",
|
||||||
|
"versionExact": "v1.2.2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "/DReHn5j0caPm3thgFD9DmOmibQ=",
|
"checksumSHA1": "/DReHn5j0caPm3thgFD9DmOmibQ=",
|
||||||
|
|
Loading…
Reference in New Issue