// Code generated by protoc-gen-gogo. DO NOT EDIT. // source: push_request.proto // source: https://raw.githubusercontent.com/grafana/loki/main/pkg/push/push_request.proto // Licensed under the Apache License, Version 2.0 (the "License"); // https://github.com/grafana/loki/blob/main/pkg/push/LICENSE package loki import ( "fmt" "io" math_bits "math/bits" "strings" "time" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" ) type PushRequest struct { Streams []Stream `protobuf:"bytes,1,rep,name=streams,proto3,customtype=Stream" json:"streams"` } func (m *PushRequest) Reset() { *m = PushRequest{} } type PushResponse struct { } func (m *PushResponse) Reset() { *m = PushResponse{} } type StreamAdapter struct { Labels string `protobuf:"bytes,1,opt,name=labels,proto3" json:"labels"` Entries []EntryAdapter `protobuf:"bytes,2,rep,name=entries,proto3" json:"entries"` // hash contains the original hash of the stream. Hash uint64 `protobuf:"varint,3,opt,name=hash,proto3" json:"-"` } func (m *StreamAdapter) Reset() { *m = StreamAdapter{} } func (m *StreamAdapter) GetLabels() string { if m != nil { return m.Labels } return "" } func (m *StreamAdapter) GetEntries() []EntryAdapter { if m != nil { return m.Entries } return nil } func (m *StreamAdapter) GetHash() uint64 { if m != nil { return m.Hash } return 0 } type EntryAdapter struct { Timestamp time.Time `protobuf:"bytes,1,opt,name=timestamp,proto3,stdtime" json:"ts"` Line string `protobuf:"bytes,2,opt,name=line,proto3" json:"line"` } func (m *EntryAdapter) Reset() { *m = EntryAdapter{} } func (m *EntryAdapter) GetTimestamp() time.Time { if m != nil { return m.Timestamp } return time.Time{} } func (m *EntryAdapter) GetLine() string { if m != nil { return m.Line } return "" } func (m *PushRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *PushRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Streams) > 0 { for iNdEx := len(m.Streams) - 1; iNdEx >= 0; iNdEx-- { { size := m.Streams[iNdEx].Size() i -= size if _, err := m.Streams[iNdEx].MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintPush(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa } } return len(dAtA) - i, nil } func (m *PushResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *PushResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l return len(dAtA) - i, nil } func (m *StreamAdapter) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *StreamAdapter) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.Hash != 0 { i = encodeVarintPush(dAtA, i, uint64(m.Hash)) i-- dAtA[i] = 0x18 } 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 = encodeVarintPush(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } } if len(m.Labels) > 0 { i -= len(m.Labels) copy(dAtA[i:], m.Labels) i = encodeVarintPush(dAtA, i, uint64(len(m.Labels))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *EntryAdapter) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *EntryAdapter) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Line) > 0 { i -= len(m.Line) copy(dAtA[i:], m.Line) i = encodeVarintPush(dAtA, i, uint64(len(m.Line))) i-- dAtA[i] = 0x12 } n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) if err1 != nil { return 0, err1 } i -= n1 i = encodeVarintPush(dAtA, i, uint64(n1)) i-- dAtA[i] = 0xa return len(dAtA) - i, nil } func encodeVarintPush(dAtA []byte, offset int, v uint64) int { offset -= sovPush(v) base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) return base } func (m *PushRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l if len(m.Streams) > 0 { for _, e := range m.Streams { l = e.Size() n += 1 + l + sovPush(uint64(l)) } } return n } func (m *PushResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l return n } func (m *StreamAdapter) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.Labels) if l > 0 { n += 1 + l + sovPush(uint64(l)) } if len(m.Entries) > 0 { for _, e := range m.Entries { l = e.Size() n += 1 + l + sovPush(uint64(l)) } } if m.Hash != 0 { n += 1 + sovPush(uint64(m.Hash)) } return n } func (m *EntryAdapter) Size() (n int) { if m == nil { return 0 } var l int _ = l l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp) n += 1 + l + sovPush(uint64(l)) l = len(m.Line) if l > 0 { n += 1 + l + sovPush(uint64(l)) } return n } func sovPush(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozPush(x uint64) (n int) { return sovPush(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (this *PushRequest) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&PushRequest{`, `Streams:` + fmt.Sprintf("%v", this.Streams) + `,`, `}`, }, "") return s } func (m *PushRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPush } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: PushRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: PushRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Streams", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPush } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthPush } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthPush } if postIndex > l { return io.ErrUnexpectedEOF } m.Streams = append(m.Streams, Stream{}) if err := m.Streams[len(m.Streams)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPush(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthPush } if (iNdEx + skippy) < 0 { return ErrInvalidLengthPush } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *PushResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPush } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: PushResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: PushResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: iNdEx = preIndex skippy, err := skipPush(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthPush } if (iNdEx + skippy) < 0 { return ErrInvalidLengthPush } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *StreamAdapter) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPush } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: StreamAdapter: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: StreamAdapter: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPush } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthPush } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthPush } if postIndex > l { return io.ErrUnexpectedEOF } m.Labels = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPush } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthPush } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthPush } if postIndex > l { return io.ErrUnexpectedEOF } m.Entries = append(m.Entries, EntryAdapter{}) if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) } m.Hash = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPush } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.Hash |= uint64(b&0x7F) << shift if b < 0x80 { break } } default: iNdEx = preIndex skippy, err := skipPush(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthPush } if (iNdEx + skippy) < 0 { return ErrInvalidLengthPush } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *EntryAdapter) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPush } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: EntryAdapter: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: EntryAdapter: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPush } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthPush } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthPush } if postIndex > l { return io.ErrUnexpectedEOF } if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Line", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPush } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthPush } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthPush } if postIndex > l { return io.ErrUnexpectedEOF } m.Line = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPush(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthPush } if (iNdEx + skippy) < 0 { return ErrInvalidLengthPush } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func skipPush(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowPush } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } wireType := int(wire & 0x7) switch wireType { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowPush } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } iNdEx++ if dAtA[iNdEx-1] < 0x80 { break } } return iNdEx, nil case 1: iNdEx += 8 return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowPush } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ length |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if length < 0 { return 0, ErrInvalidLengthPush } iNdEx += length if iNdEx < 0 { return 0, ErrInvalidLengthPush } return iNdEx, nil case 3: for { var innerWire uint64 var start int = iNdEx for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowPush } 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 := skipPush(dAtA[start:]) if err != nil { return 0, err } iNdEx = start + next if iNdEx < 0 { return 0, ErrInvalidLengthPush } } return iNdEx, nil case 4: return iNdEx, nil case 5: iNdEx += 4 return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } } panic("unreachable") } var ( ErrInvalidLengthPush = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowPush = fmt.Errorf("proto: integer overflow") )