Skip to content

Commit

Permalink
kgo Offset: add EpochOffset getter field
Browse files Browse the repository at this point in the history
There was no way to actually inspect what epoch or offset an Offset was
at, which made some adjust functions less useful.
  • Loading branch information
twmb committed Jul 8, 2023
1 parent c5d0fc5 commit 875761a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/kgo/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ func (o Offset) String() string {
}
}

// EpochOffset returns this offset as an EpochOffset, allowing visibility into
// what this offset actually currently is.
func (o Offset) EpochOffset() EpochOffset {
return EpochOffset{
Epoch: o.epoch,
Offset: o.at,
}
}

// NewOffset creates and returns an offset to use in ConsumePartitions or
// ConsumeResetOffset.
//
Expand Down

0 comments on commit 875761a

Please sign in to comment.