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

Method MarshalToSizedBuffer

pkg/ring/ring.pb.go:435–488  ·  view source on GitHub ↗
(dAtA []byte)

Source from the content-addressed store, hash-verified

433}
434
435func (m *InstanceDesc) MarshalToSizedBuffer(dAtA []byte) (int, error) {
436 i := len(dAtA)
437 _ = i
438 var l int
439 _ = l
440 if m.RegisteredTimestamp != 0 {
441 i = encodeVarintRing(dAtA, i, uint64(m.RegisteredTimestamp))
442 i--
443 dAtA[i] = 0x40
444 }
445 if len(m.Zone) > 0 {
446 i -= len(m.Zone)
447 copy(dAtA[i:], m.Zone)
448 i = encodeVarintRing(dAtA, i, uint64(len(m.Zone)))
449 i--
450 dAtA[i] = 0x3a
451 }
452 if len(m.Tokens) > 0 {
453 dAtA3 := make([]byte, len(m.Tokens)*10)
454 var j2 int
455 for _, num := range m.Tokens {
456 for num >= 1<<7 {
457 dAtA3[j2] = uint8(uint64(num)&0x7f | 0x80)
458 num >>= 7
459 j2++
460 }
461 dAtA3[j2] = uint8(num)
462 j2++
463 }
464 i -= j2
465 copy(dAtA[i:], dAtA3[:j2])
466 i = encodeVarintRing(dAtA, i, uint64(j2))
467 i--
468 dAtA[i] = 0x32
469 }
470 if m.State != 0 {
471 i = encodeVarintRing(dAtA, i, uint64(m.State))
472 i--
473 dAtA[i] = 0x18
474 }
475 if m.Timestamp != 0 {
476 i = encodeVarintRing(dAtA, i, uint64(m.Timestamp))
477 i--
478 dAtA[i] = 0x10
479 }
480 if len(m.Addr) > 0 {
481 i -= len(m.Addr)
482 copy(dAtA[i:], m.Addr)
483 i = encodeVarintRing(dAtA, i, uint64(len(m.Addr)))
484 i--
485 dAtA[i] = 0xa
486 }
487 return len(dAtA) - i, nil
488}
489
490func encodeVarintRing(dAtA []byte, offset int, v uint64) int {
491 offset -= sovRing(v)

Callers 3

XXX_MarshalMethod · 0.95
MarshalMethod · 0.95
MarshalToMethod · 0.95

Calls 1

encodeVarintRingFunction · 0.85

Tested by

no test coverage detected