MCPcopy
hub / github.com/segmentio/kafka-go / merge

Method merge

reader.go:172–184  ·  view source on GitHub ↗

merge updates the offsetStash with the offsets from the provided messages.

(commits []commit)

Source from the content-addressed store, hash-verified

170
171// merge updates the offsetStash with the offsets from the provided messages.
172func (o offsetStash) merge(commits []commit) {
173 for _, c := range commits {
174 offsetsByPartition, ok := o[c.topic]
175 if !ok {
176 offsetsByPartition = map[int]int64{}
177 o[c.topic] = offsetsByPartition
178 }
179
180 if offset, ok := offsetsByPartition[c.partition]; !ok || c.offset > offset {
181 offsetsByPartition[c.partition] = c.offset
182 }
183 }
184}
185
186// reset clears the contents of the offsetStash.
187func (o offsetStash) reset() {

Callers 3

commitLoopImmediateMethod · 0.95
commitLoopIntervalMethod · 0.95
TestOffsetStashFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestOffsetStashFunction · 0.64