MCPcopy
hub / github.com/grafana/dskit / MarshalToSizedBuffer

Method MarshalToSizedBuffer

ring/partition_ring_desc.pb.go:573–625  ·  view source on GitHub ↗
(dAtA []byte)

Source from the content-addressed store, hash-verified

571}
572
573func (m *PartitionRingDesc) MarshalToSizedBuffer(dAtA []byte) (int, error) {
574 i := len(dAtA)
575 _ = i
576 var l int
577 _ = l
578 if len(m.Owners) > 0 {
579 for k := range m.Owners {
580 v := m.Owners[k]
581 baseI := i
582 {
583 size, err := (&v).MarshalToSizedBuffer(dAtA[:i])
584 if err != nil {
585 return 0, err
586 }
587 i -= size
588 i = encodeVarintPartitionRingDesc(dAtA, i, uint64(size))
589 }
590 i--
591 dAtA[i] = 0x12
592 i -= len(k)
593 copy(dAtA[i:], k)
594 i = encodeVarintPartitionRingDesc(dAtA, i, uint64(len(k)))
595 i--
596 dAtA[i] = 0xa
597 i = encodeVarintPartitionRingDesc(dAtA, i, uint64(baseI-i))
598 i--
599 dAtA[i] = 0x12
600 }
601 }
602 if len(m.Partitions) > 0 {
603 for k := range m.Partitions {
604 v := m.Partitions[k]
605 baseI := i
606 {
607 size, err := (&v).MarshalToSizedBuffer(dAtA[:i])
608 if err != nil {
609 return 0, err
610 }
611 i -= size
612 i = encodeVarintPartitionRingDesc(dAtA, i, uint64(size))
613 }
614 i--
615 dAtA[i] = 0x12
616 i = encodeVarintPartitionRingDesc(dAtA, i, uint64(k))
617 i--
618 dAtA[i] = 0x8
619 i = encodeVarintPartitionRingDesc(dAtA, i, uint64(baseI-i))
620 i--
621 dAtA[i] = 0xa
622 }
623 }
624 return len(dAtA) - i, nil
625}
626
627func (m *PartitionDesc) Marshal() (dAtA []byte, err error) {
628 size := m.Size()

Callers 3

XXX_MarshalMethod · 0.95
MarshalMethod · 0.95
MarshalToMethod · 0.95

Calls 2

MarshalToSizedBufferMethod · 0.45

Tested by

no test coverage detected