From 99e717ad18096aa86ff3eec4dd9ff5bce6435339 Mon Sep 17 00:00:00 2001 From: Krasi Georgiev Date: Thu, 1 Mar 2018 11:57:31 +0200 Subject: [PATCH] revert ot using the gogofast plugin and regenerate grpc server --- prompb/remote.pb.go | 18 ------------------ prompb/rpc.pb.go | 42 +++++++++++------------------------------- prompb/rpc.pb.gw.go | 6 ++++-- prompb/types.pb.go | 32 +++++--------------------------- scripts/genproto.sh | 2 +- 5 files changed, 21 insertions(+), 79 deletions(-) diff --git a/prompb/remote.pb.go b/prompb/remote.pb.go index ad91fa5b9..e7ad9d76d 100644 --- a/prompb/remote.pb.go +++ b/prompb/remote.pb.go @@ -311,24 +311,6 @@ func (m *QueryResult) MarshalTo(dAtA []byte) (int, error) { 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 { for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) diff --git a/prompb/rpc.pb.go b/prompb/rpc.pb.go index 40c3e9436..ffa2f66df 100644 --- a/prompb/rpc.pb.go +++ b/prompb/rpc.pb.go @@ -12,12 +12,10 @@ import _ "github.com/gogo/protobuf/gogoproto" import time "time" -import ( - context "golang.org/x/net/context" - grpc "google.golang.org/grpc" -) +import context "golang.org/x/net/context" +import grpc "google.golang.org/grpc" -import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" +import types "github.com/gogo/protobuf/types" import io "io" @@ -328,8 +326,8 @@ func (m *SeriesDeleteRequest) MarshalTo(dAtA []byte) (int, error) { if m.MinTime != nil { dAtA[i] = 0xa i++ - i = encodeVarintRpc(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(*m.MinTime))) - n1, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.MinTime, dAtA[i:]) + i = encodeVarintRpc(dAtA, i, uint64(types.SizeOfStdTime(*m.MinTime))) + n1, err := types.StdTimeMarshalTo(*m.MinTime, dAtA[i:]) if err != nil { return 0, err } @@ -338,8 +336,8 @@ func (m *SeriesDeleteRequest) MarshalTo(dAtA []byte) (int, error) { if m.MaxTime != nil { dAtA[i] = 0x12 i++ - i = encodeVarintRpc(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(*m.MaxTime))) - n2, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.MaxTime, dAtA[i:]) + i = encodeVarintRpc(dAtA, i, uint64(types.SizeOfStdTime(*m.MaxTime))) + n2, err := types.StdTimeMarshalTo(*m.MaxTime, dAtA[i:]) if err != nil { return 0, err } @@ -378,24 +376,6 @@ func (m *SeriesDeleteResponse) MarshalTo(dAtA []byte) (int, error) { 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 { for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) @@ -437,11 +417,11 @@ func (m *SeriesDeleteRequest) Size() (n int) { var l int _ = l if m.MinTime != nil { - l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.MinTime) + l = types.SizeOfStdTime(*m.MinTime) n += 1 + l + sovRpc(uint64(l)) } if m.MaxTime != nil { - l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.MaxTime) + l = types.SizeOfStdTime(*m.MaxTime) n += 1 + l + sovRpc(uint64(l)) } if len(m.Matchers) > 0 { @@ -759,7 +739,7 @@ func (m *SeriesDeleteRequest) Unmarshal(dAtA []byte) error { if m.MinTime == nil { m.MinTime = new(time.Time) } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.MinTime, dAtA[iNdEx:postIndex]); err != nil { + if err := types.StdTimeUnmarshal(m.MinTime, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -792,7 +772,7 @@ func (m *SeriesDeleteRequest) Unmarshal(dAtA []byte) error { if m.MaxTime == nil { m.MaxTime = new(time.Time) } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.MaxTime, dAtA[iNdEx:postIndex]); err != nil { + if err := types.StdTimeUnmarshal(m.MaxTime, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/prompb/rpc.pb.gw.go b/prompb/rpc.pb.gw.go index 177ea4c10..71ce638e3 100644 --- a/prompb/rpc.pb.gw.go +++ b/prompb/rpc.pb.gw.go @@ -50,8 +50,10 @@ func request_Admin_DeleteSeries_0(ctx context.Context, marshaler runtime.Marshal var protoReq SeriesDeleteRequest var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if req.ContentLength > 0 { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } } msg, err := client.DeleteSeries(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) diff --git a/prompb/types.pb.go b/prompb/types.pb.go index 3edff74f9..59a4a4b0c 100644 --- a/prompb/types.pb.go +++ b/prompb/types.pb.go @@ -8,6 +8,8 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" +import binary "encoding/binary" + import io "io" // Reference imports to suppress errors if they are not otherwise used. @@ -189,7 +191,8 @@ func (m *Sample) MarshalTo(dAtA []byte) (int, error) { if m.Value != 0 { dAtA[i] = 0x9 i++ - i = encodeFixed64Types(dAtA, i, uint64(math.Float64bits(float64(m.Value)))) + binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value)))) + i += 8 } if m.Timestamp != 0 { dAtA[i] = 0x10 @@ -336,24 +339,6 @@ func (m *LabelMatcher) MarshalTo(dAtA []byte) (int, error) { 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 { for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) @@ -486,15 +471,8 @@ func (m *Sample) Unmarshal(dAtA []byte) error { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) 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)) case 2: if wireType != 0 { diff --git a/scripts/genproto.sh b/scripts/genproto.sh index 643c06200..a46eedc76 100755 --- a/scripts/genproto.sh +++ b/scripts/genproto.sh @@ -25,7 +25,7 @@ DIRS="prompb" for dir in ${DIRS}; do pushd ${dir} - protoc --gofast_out=plugins=grpc:. -I=. \ + protoc --gogofast_out=plugins=grpc:. -I=. \ -I="${GOGOPROTO_PATH}" \ -I="${PROM_PATH}" \ -I="${GRPC_GATEWAY_ROOT}/third_party/googleapis" \