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

Method decode

offset_fetch_request.go:174–279  ·  view source on GitHub ↗
(pd packetDecoder, version int16)

Source from the content-addressed store, hash-verified

172}
173
174func (r *OffsetFetchRequest) decode(pd packetDecoder, version int16) (err error) {
175 r.Version = version
176
177 if r.Version >= 8 {
178 groupCount, err := pd.getArrayLength()
179 if err != nil {
180 return err
181 }
182 if groupCount < 0 {
183 return errInvalidArrayLength
184 }
185 if groupCount > 0 {
186 r.Groups = make([]OffsetFetchRequestGroup, groupCount)
187 }
188 for i := range groupCount {
189 groupID, err := pd.getString()
190 if err != nil {
191 return err
192 }
193 r.Groups[i].GroupId = groupID
194
195 // peek first byte to distinguish null (0x00) from empty (0x01)
196 topicCountMarker, err := pd.peekInt8(0)
197 if err != nil {
198 return err
199 }
200 topicCount, err := pd.getArrayLength()
201 if err != nil {
202 return err
203 }
204 if topicCountMarker != 0 {
205 partitions := make(map[string][]int32, topicCount)
206 for range topicCount {
207 topic, err := pd.getString()
208 if err != nil {
209 return err
210 }
211 ps, err := pd.getInt32Array()
212 if err != nil {
213 return err
214 }
215 if _, err := pd.getEmptyTaggedFieldArray(); err != nil {
216 return err
217 }
218 partitions[topic] = ps
219 }
220 r.Groups[i].Partitions = partitions
221 }
222
223 if _, err := pd.getEmptyTaggedFieldArray(); err != nil {
224 return err
225 }
226 }
227
228 r.RequireStable, err = pd.getBool()
229 if err != nil {
230 return err
231 }

Callers

nothing calls this directly

Calls 6

getArrayLengthMethod · 0.65
getStringMethod · 0.65
peekInt8Method · 0.65
getInt32ArrayMethod · 0.65
getBoolMethod · 0.65

Tested by

no test coverage detected