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

Method AddPartition

offset_fetch_request.go:344–357  ·  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

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

Callers 2

TestOffsetFetchRequestFunction · 0.95
AddGroupPartitionMethod · 0.45

Calls

no outgoing calls

Tested by 1

TestOffsetFetchRequestFunction · 0.76