(topic string, partitionID int32, fetchOffset int64, maxBytes int32, leaderEpoch int32)
| 342 | } |
| 343 | |
| 344 | func (r *FetchRequest) AddBlock(topic string, partitionID int32, fetchOffset int64, maxBytes int32, leaderEpoch int32) { |
| 345 | if r.blocks == nil { |
| 346 | r.blocks = make(map[string]map[int32]*fetchRequestBlock) |
| 347 | } |
| 348 | |
| 349 | if r.Version >= 7 && r.forgotten == nil { |
| 350 | r.forgotten = make(map[string][]int32) |
| 351 | } |
| 352 | |
| 353 | if r.blocks[topic] == nil { |
| 354 | r.blocks[topic] = make(map[int32]*fetchRequestBlock) |
| 355 | } |
| 356 | |
| 357 | tmp := new(fetchRequestBlock) |
| 358 | tmp.Version = r.Version |
| 359 | tmp.maxBytes = maxBytes |
| 360 | tmp.fetchOffset = fetchOffset |
| 361 | if r.Version >= 12 { |
| 362 | tmp.lastFetchedEpoch = -1 |
| 363 | } |
| 364 | if r.Version >= 9 { |
| 365 | tmp.currentLeaderEpoch = leaderEpoch |
| 366 | } |
| 367 | |
| 368 | r.blocks[topic][partitionID] = tmp |
| 369 | } |
no outgoing calls