MCPcopy
hub / github.com/IBM/sarama / AddBlock

Method AddBlock

fetch_request.go:344–369  ·  view source on GitHub ↗
(topic string, partitionID int32, fetchOffset int64, maxBytes int32, leaderEpoch int32)

Source from the content-addressed store, hash-verified

342}
343
344func (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}

Callers 13

fetchNewMessagesMethod · 0.95
TestFetchRequestFunction · 0.45
TestOffsetRequestFunction · 0.45
TestOffsetRequestV1Function · 0.45
TestOffsetRequestV2Function · 0.45
TestOffsetRequestV4Function · 0.45
ListOffsetsMethod · 0.45

Calls

no outgoing calls

Tested by 11

TestFetchRequestFunction · 0.36
TestOffsetRequestFunction · 0.36
TestOffsetRequestV1Function · 0.36
TestOffsetRequestV2Function · 0.36
TestOffsetRequestV4Function · 0.36