mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-22 16:36:27 +01:00
54 lines
957 B
Go
54 lines
957 B
Go
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
|
// source: remote.proto
|
|
|
|
package prompbmarshal
|
|
|
|
import (
|
|
"math/bits"
|
|
)
|
|
|
|
type WriteRequest struct {
|
|
Timeseries []TimeSeries
|
|
}
|
|
|
|
func (m *WriteRequest) MarshalToSizedBuffer(dst []byte) (int, error) {
|
|
i := len(dst)
|
|
for j := len(m.Timeseries) - 1; j >= 0; j-- {
|
|
size, err := m.Timeseries[j].MarshalToSizedBuffer(dst[:i])
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
i -= size
|
|
i = encodeVarint(dst, i, uint64(size))
|
|
i--
|
|
dst[i] = 0xa
|
|
}
|
|
return len(dst) - i, nil
|
|
}
|
|
|
|
func encodeVarint(dst []byte, offset int, v uint64) int {
|
|
offset -= sov(v)
|
|
base := offset
|
|
for v >= 1<<7 {
|
|
dst[offset] = uint8(v&0x7f | 0x80)
|
|
v >>= 7
|
|
offset++
|
|
}
|
|
dst[offset] = uint8(v)
|
|
return base
|
|
}
|
|
func (m *WriteRequest) Size() (n int) {
|
|
if m == nil {
|
|
return 0
|
|
}
|
|
for _, e := range m.Timeseries {
|
|
l := e.Size()
|
|
n += 1 + l + sov(uint64(l))
|
|
}
|
|
return n
|
|
}
|
|
|
|
func sov(x uint64) (n int) {
|
|
return (bits.Len64(x|1) + 6) / 7
|
|
}
|