in offset_fetch_request.go [120:193]
func (r *OffsetFetchRequest) decode(pd packetDecoder, version int16) (err error) {
r.Version = version
isFlexible := r.Version >= 6
if isFlexible {
r.ConsumerGroup, err = pd.getCompactString()
} else {
r.ConsumerGroup, err = pd.getString()
}
if err != nil {
return err
}
var partitionCount int
if isFlexible {
partitionCount, err = pd.getCompactArrayLength()
} else {
partitionCount, err = pd.getArrayLength()
}
if err != nil {
return err
}
if (partitionCount == 0 && version < 2) || partitionCount < 0 {
return nil
}
r.partitions = make(map[string][]int32, partitionCount)
for i := 0; i < partitionCount; i++ {
var topic string
if isFlexible {
topic, err = pd.getCompactString()
} else {
topic, err = pd.getString()
}
if err != nil {
return err
}
var partitions []int32
if isFlexible {
partitions, err = pd.getCompactInt32Array()
} else {
partitions, err = pd.getInt32Array()
}
if err != nil {
return err
}
if isFlexible {
_, err = pd.getEmptyTaggedFieldArray()
if err != nil {
return err
}
}
r.partitions[topic] = partitions
}
if r.Version >= 7 {
r.RequireStable, err = pd.getBool()
if err != nil {
return err
}
}
if isFlexible {
_, err = pd.getEmptyTaggedFieldArray()
if err != nil {
return err
}
}
return nil
}