| 256 | } |
| 257 | |
| 258 | func (r *OffsetRequest) AddBlock(topic string, partitionID int32, timestamp int64, maxOffsets int32) { |
| 259 | if r.blocks == nil { |
| 260 | r.blocks = make(map[string]map[int32]*offsetRequestBlock) |
| 261 | } |
| 262 | |
| 263 | if r.blocks[topic] == nil { |
| 264 | r.blocks[topic] = make(map[int32]*offsetRequestBlock) |
| 265 | } |
| 266 | |
| 267 | tmp := new(offsetRequestBlock) |
| 268 | tmp.currentLeaderEpoch = -1 |
| 269 | tmp.timestamp = timestamp |
| 270 | if r.Version == 0 { |
| 271 | tmp.maxNumOffsets = maxOffsets |
| 272 | } |
| 273 | |
| 274 | r.blocks[topic][partitionID] = tmp |
| 275 | } |