AddBlock adds a block for topic/partition. On v8+ it appends under Groups[0], creating it if needed.
(topic string, partition int32, block *OffsetFetchResponseBlock)
| 432 | // AddBlock adds a block for topic/partition. On v8+ it appends under Groups[0], |
| 433 | // creating it if needed. |
| 434 | func (r *OffsetFetchResponse) AddBlock(topic string, partition int32, block *OffsetFetchResponseBlock) { |
| 435 | if r.Version >= 8 { |
| 436 | if len(r.Groups) == 0 { |
| 437 | r.Groups = []OffsetFetchResponseGroup{{}} |
| 438 | } |
| 439 | r.Groups[0].AddBlock(topic, partition, block) |
| 440 | return |
| 441 | } |
| 442 | if r.Blocks == nil { |
| 443 | r.Blocks = make(map[string]map[int32]*OffsetFetchResponseBlock) |
| 444 | } |
| 445 | partitions := r.Blocks[topic] |
| 446 | if partitions == nil { |
| 447 | partitions = make(map[int32]*OffsetFetchResponseBlock) |
| 448 | r.Blocks[topic] = partitions |
| 449 | } |
| 450 | partitions[partition] = block |
| 451 | } |
| 452 | |
| 453 | // AddGroupBlock adds a block for groupID/topic/partition, creating the group |
| 454 | // entry if needed. On v0-7 it falls back to AddBlock and ignores groupID. |
no outgoing calls