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

Method decode

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

Source from the content-addressed store, hash-verified

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