2024-02-01 05:33:03 +01:00
|
|
|
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
|
|
|
// source: remote.proto
|
|
|
|
|
|
|
|
package prompbmarshal
|
|
|
|
|
|
|
|
import (
|
2024-02-01 20:31:08 +01:00
|
|
|
"math/bits"
|
2024-02-01 05:33:03 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
type WriteRequest struct {
|
|
|
|
Timeseries []TimeSeries
|
|
|
|
}
|
|
|
|
|
2024-02-01 20:31:08 +01:00
|
|
|
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
|
2024-02-01 05:33:03 +01:00
|
|
|
}
|
2024-02-01 20:31:08 +01:00
|
|
|
i -= size
|
|
|
|
i = encodeVarint(dst, i, uint64(size))
|
|
|
|
i--
|
|
|
|
dst[i] = 0xa
|
2024-02-01 05:33:03 +01:00
|
|
|
}
|
2024-02-01 20:31:08 +01:00
|
|
|
return len(dst) - i, nil
|
2024-02-01 05:33:03 +01:00
|
|
|
}
|
|
|
|
|
2024-02-01 20:31:08 +01:00
|
|
|
func encodeVarint(dst []byte, offset int, v uint64) int {
|
2024-02-01 05:33:03 +01:00
|
|
|
offset -= sov(v)
|
|
|
|
base := offset
|
|
|
|
for v >= 1<<7 {
|
2024-02-01 20:31:08 +01:00
|
|
|
dst[offset] = uint8(v&0x7f | 0x80)
|
2024-02-01 05:33:03 +01:00
|
|
|
v >>= 7
|
|
|
|
offset++
|
|
|
|
}
|
2024-02-01 20:31:08 +01:00
|
|
|
dst[offset] = uint8(v)
|
2024-02-01 05:33:03 +01:00
|
|
|
return base
|
|
|
|
}
|
|
|
|
func (m *WriteRequest) Size() (n int) {
|
|
|
|
if m == nil {
|
|
|
|
return 0
|
|
|
|
}
|
2024-02-01 20:31:08 +01:00
|
|
|
for _, e := range m.Timeseries {
|
|
|
|
l := e.Size()
|
|
|
|
n += 1 + l + sov(uint64(l))
|
2024-02-01 05:33:03 +01:00
|
|
|
}
|
|
|
|
return n
|
|
|
|
}
|
|
|
|
|
|
|
|
func sov(x uint64) (n int) {
|
2024-02-01 20:31:08 +01:00
|
|
|
return (bits.Len64(x|1) + 6) / 7
|
2024-02-01 05:33:03 +01:00
|
|
|
}
|