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

Method decode

offset_commit_request.go:189–259  ·  view source on GitHub ↗
(pd packetDecoder, version int16)

Source from the content-addressed store, hash-verified

187}
188
189func (r *OffsetCommitRequest) decode(pd packetDecoder, version int16) (err error) {
190 r.Version = version
191
192 if r.ConsumerGroup, err = pd.getString(); err != nil {
193 return err
194 }
195
196 if r.Version >= 1 {
197 if r.ConsumerGroupGeneration, err = pd.getInt32(); err != nil {
198 return err
199 }
200 if r.ConsumerID, err = pd.getString(); err != nil {
201 return err
202 }
203 }
204
205 // Version 5 removes RetentionTime, which is now controlled only by a broker configuration.
206 if r.Version >= 2 && r.Version <= 4 {
207 if r.RetentionTime, err = pd.getInt64(); err != nil {
208 return err
209 }
210 }
211
212 if r.Version >= 7 {
213 if r.GroupInstanceId, err = pd.getNullableString(); err != nil {
214 return err
215 }
216 }
217
218 topicCount, err := pd.getArrayLength()
219 if err != nil {
220 return err
221 }
222 if topicCount < 0 {
223 return errInvalidArrayLength
224 }
225 if topicCount > 0 {
226 r.blocks = make(map[string]map[int32]*offsetCommitRequestBlock)
227 for range topicCount {
228 topic, err := pd.getString()
229 if err != nil {
230 return err
231 }
232 partitionCount, err := pd.getArrayLength()
233 if err != nil {
234 return err
235 }
236 if partitionCount < 0 {
237 return errInvalidArrayLength
238 }
239 r.blocks[topic] = make(map[int32]*offsetCommitRequestBlock)
240 for range partitionCount {
241 partition, err := pd.getInt32()
242 if err != nil {
243 return err
244 }
245 block := &offsetCommitRequestBlock{}
246 if err := block.decode(pd, r.Version); err != nil {

Callers

nothing calls this directly

Calls 7

decodeMethod · 0.95
getStringMethod · 0.65
getInt32Method · 0.65
getInt64Method · 0.65
getNullableStringMethod · 0.65
getArrayLengthMethod · 0.65

Tested by

no test coverage detected