offsetcommit.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package offsetcommit
  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=v7"`
  8. GenerationID int32 `kafka:"min=v1,max=v7"`
  9. MemberID string `kafka:"min=v1,max=v7"`
  10. RetentionTimeMs int64 `kafka:"min=v2,max=v4"`
  11. GroupInstanceID string `kafka:"min=v7,max=v7,nullable"`
  12. Topics []RequestTopic `kafka:"min=v0,max=v7"`
  13. }
  14. func (r *Request) ApiKey() protocol.ApiKey { return protocol.OffsetCommit }
  15. func (r *Request) Group() string { return r.GroupID }
  16. type RequestTopic struct {
  17. Name string `kafka:"min=v0,max=v7"`
  18. Partitions []RequestPartition `kafka:"min=v0,max=v7"`
  19. }
  20. type RequestPartition struct {
  21. PartitionIndex int32 `kafka:"min=v0,max=v7"`
  22. CommittedOffset int64 `kafka:"min=v0,max=v7"`
  23. CommitTimestamp int64 `kafka:"min=v1,max=v1"`
  24. CommittedLeaderEpoch int32 `kafka:"min=v5,max=v7"`
  25. CommittedMetadata string `kafka:"min=v0,max=v7,nullable"`
  26. }
  27. var (
  28. _ protocol.GroupMessage = (*Request)(nil)
  29. )
  30. type Response struct {
  31. ThrottleTimeMs int32 `kafka:"min=v3,max=v7"`
  32. Topics []ResponseTopic `kafka:"min=v0,max=v7"`
  33. }
  34. func (r *Response) ApiKey() protocol.ApiKey { return protocol.OffsetCommit }
  35. type ResponseTopic struct {
  36. Name string `kafka:"min=v0,max=v7"`
  37. Partitions []ResponsePartition `kafka:"min=v0,max=v7"`
  38. }
  39. type ResponsePartition struct {
  40. PartitionIndex int32 `kafka:"min=v0,max=v7"`
  41. ErrorCode int16 `kafka:"min=v0,max=v7"`
  42. }