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

Method ReadOffsets

conn.go:912–924  ·  view source on GitHub ↗

ReadOffsets returns the absolute first and last offsets of the topic used by the connection.

()

Source from the content-addressed store, hash-verified

910// ReadOffsets returns the absolute first and last offsets of the topic used by
911// the connection.
912func (c *Conn) ReadOffsets() (first, last int64, err error) {
913 // We have to submit two different requests to fetch the first and last
914 // offsets because kafka refuses requests that ask for multiple offsets
915 // on the same topic and partition.
916 if first, err = c.ReadFirstOffset(); err != nil {
917 return
918 }
919 if last, err = c.ReadLastOffset(); err != nil {
920 first = 0 // don't leak the value on error
921 return
922 }
923 return
924}
925
926func (c *Conn) readOffset(t int64) (offset int64, err error) {
927 err = c.readOperation(

Callers 4

SeekMethod · 0.95
ReadLagMethod · 0.95
benchmarkConnReadOffsetsFunction · 0.80
readOffsetsMethod · 0.80

Calls 2

ReadFirstOffsetMethod · 0.95
ReadLastOffsetMethod · 0.95

Tested by 1

benchmarkConnReadOffsetsFunction · 0.64