offsetfetch.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package offsetfetch
  2. import "github.com/segmentio/kafka-go/protocol"
  3. func init() {
  4. protocol.Register(&Request{}, &Response{})
  5. }
  6. type Request struct {
  7. GroupID string `kafka:"min=v0,max=v5"`
  8. Topics []RequestTopic `kafka:"min=v0,max=v5"`
  9. }
  10. func (r *Request) ApiKey() protocol.ApiKey { return protocol.OffsetFetch }
  11. func (r *Request) Group() string { return r.GroupID }
  12. type RequestTopic struct {
  13. Name string `kafka:"min=v0,max=v5"`
  14. PartitionIndexes []int32 `kafka:"min=v0,max=v5"`
  15. }
  16. var (
  17. _ protocol.GroupMessage = (*Request)(nil)
  18. )
  19. type Response struct {
  20. ThrottleTimeMs int32 `kafka:"min=v3,max=v5"`
  21. Topics []ResponseTopic `kafka:"min=v0,max=v5"`
  22. ErrorCode int16 `kafka:"min=v2,max=v5"`
  23. }
  24. func (r *Response) ApiKey() protocol.ApiKey { return protocol.OffsetFetch }
  25. type ResponseTopic struct {
  26. Name string `kafka:"min=v0,max=v5"`
  27. Partitions []ResponsePartition `kafka:"min=v0,max=v5"`
  28. }
  29. type ResponsePartition struct {
  30. PartitionIndex int32 `kafka:"min=v0,max=v5"`
  31. CommittedOffset int64 `kafka:"min=v0,max=v5"`
  32. ComittedLeaderEpoch int32 `kafka:"min=v5,max=v5"`
  33. Metadata string `kafka:"min=v0,max=v5,nullable"`
  34. ErrorCode int16 `kafka:"min=v0,max=v5"`
  35. }