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

Method AddPartition

offset_fetch_request.go:351–364  ·  view source on GitHub ↗

AddPartition appends a partition to the request. On v8+ it targets Groups[0] (seeded from ConsumerGroup if needed); use AddGroupPartition for v8 batches.

(topic string, partitionID int32)

Source from the content-addressed store, hash-verified

349// AddPartition appends a partition to the request. On v8+ it targets Groups[0]
350// (seeded from ConsumerGroup if needed); use AddGroupPartition for v8 batches.
351func (r *OffsetFetchRequest) AddPartition(topic string, partitionID int32) {
352 if r.Version >= 8 {
353 if len(r.Groups) == 0 {
354 r.Groups = []OffsetFetchRequestGroup{{GroupId: r.ConsumerGroup}}
355 }
356 r.Groups[0].AddPartition(topic, partitionID)
357 return
358 }
359 if r.partitions == nil {
360 r.partitions = make(map[string][]int32)
361 }
362
363 r.partitions[topic] = append(r.partitions[topic], partitionID)
364}
365
366// AddGroupPartition adds a partition under group in a v8+ batch, creating the
367// group entry if absent.

Callers 2

TestOffsetFetchRequestFunction · 0.95
AddGroupPartitionMethod · 0.45

Calls

no outgoing calls

Tested by 1

TestOffsetFetchRequestFunction · 0.76