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

Method Offset

reader.go:990–1002  ·  view source on GitHub ↗

Offset returns the current absolute offset of the reader, or -1 if r is backed by a consumer group.

()

Source from the content-addressed store, hash-verified

988// Offset returns the current absolute offset of the reader, or -1
989// if r is backed by a consumer group.
990func (r *Reader) Offset() int64 {
991 if r.useConsumerGroup() {
992 return -1
993 }
994
995 r.mutex.Lock()
996 offset := r.offset
997 r.mutex.Unlock()
998 r.withLogger(func(log Logger) {
999 log.Printf("looking up offset of kafka reader for partition %d of %s: %s", r.config.Partition, r.config.Topic, toHumanOffset(offset))
1000 })
1001 return offset
1002}
1003
1004// Lag returns the lag of the last message returned by ReadMessage, or -1
1005// if r is backed by a consumer group.

Callers 2

ReadLagMethod · 0.95

Calls 4

useConsumerGroupMethod · 0.95
withLoggerMethod · 0.95
toHumanOffsetFunction · 0.85
PrintfMethod · 0.65