MCPcopy Create free account
hub / github.com/IBM/sarama / encode

Method encode

fetch_response.go:474–511  ·  view source on GitHub ↗
(pe packetEncoder)

Source from the content-addressed store, hash-verified

472}
473
474func (r *FetchResponse) encode(pe packetEncoder) (err error) {
475 if r.Version >= 1 {
476 pe.putDurationMs(r.ThrottleTime)
477 }
478
479 if r.Version >= 7 {
480 pe.putInt16(r.ErrorCode)
481 pe.putInt32(r.SessionID)
482 }
483
484 err = pe.putArrayLength(len(r.Blocks))
485 if err != nil {
486 return err
487 }
488
489 for topic, partitions := range r.Blocks {
490 err = pe.putString(topic)
491 if err != nil {
492 return err
493 }
494
495 err = pe.putArrayLength(len(partitions))
496 if err != nil {
497 return err
498 }
499
500 for id, block := range partitions {
501 pe.putInt32(id)
502 err = block.encode(pe, r.Version)
503 if err != nil {
504 return err
505 }
506 }
507 pe.putEmptyTaggedFieldArray()
508 }
509 pe.putEmptyTaggedFieldArray()
510 return nil
511}
512
513func (r *FetchResponse) key() int16 {
514 return apiKeyFetch

Callers

nothing calls this directly

Calls 7

putDurationMsMethod · 0.65
putInt16Method · 0.65
putInt32Method · 0.65
putArrayLengthMethod · 0.65
putStringMethod · 0.65
encodeMethod · 0.65

Tested by

no test coverage detected