MCPcopy Create free account
hub / github.com/cortexproject/cortex / Unmarshal

Method Unmarshal

pkg/cortexpb/cortex.pb.go:5903–5985  ·  view source on GitHub ↗
(dAtA []byte)

Source from the content-addressed store, hash-verified

5901 return nil
5902}
5903func (m *Sample) Unmarshal(dAtA []byte) error {
5904 l := len(dAtA)
5905 iNdEx := 0
5906 for iNdEx < l {
5907 preIndex := iNdEx
5908 var wire uint64
5909 for shift := uint(0); ; shift += 7 {
5910 if shift >= 64 {
5911 return ErrIntOverflowCortex
5912 }
5913 if iNdEx >= l {
5914 return io.ErrUnexpectedEOF
5915 }
5916 b := dAtA[iNdEx]
5917 iNdEx++
5918 wire |= uint64(b&0x7F) << shift
5919 if b < 0x80 {
5920 break
5921 }
5922 }
5923 fieldNum := int32(wire >> 3)
5924 wireType := int(wire & 0x7)
5925 if wireType == 4 {
5926 return fmt.Errorf("proto: Sample: wiretype end group for non-group")
5927 }
5928 if fieldNum <= 0 {
5929 return fmt.Errorf("proto: Sample: illegal tag %d (wire type %d)", fieldNum, wire)
5930 }
5931 switch fieldNum {
5932 case 1:
5933 if wireType != 1 {
5934 return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
5935 }
5936 var v uint64
5937 if (iNdEx + 8) > l {
5938 return io.ErrUnexpectedEOF
5939 }
5940 v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:]))
5941 iNdEx += 8
5942 m.Value = float64(math.Float64frombits(v))
5943 case 2:
5944 if wireType != 0 {
5945 return fmt.Errorf("proto: wrong wireType = %d for field TimestampMs", wireType)
5946 }
5947 m.TimestampMs = 0
5948 for shift := uint(0); ; shift += 7 {
5949 if shift >= 64 {
5950 return ErrIntOverflowCortex
5951 }
5952 if iNdEx >= l {
5953 return io.ErrUnexpectedEOF
5954 }
5955 b := dAtA[iNdEx]
5956 iNdEx++
5957 m.TimestampMs |= int64(b&0x7F) << shift
5958 if b < 0x80 {
5959 break
5960 }

Calls 1

skipCortexFunction · 0.85