txnoffsetcommit.go 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package txnoffsetcommit
  2. import "github.com/segmentio/kafka-go/protocol"
  3. func init() {
  4. protocol.Register(&Request{}, &Response{})
  5. }
  6. type Request struct {
  7. // We need at least one tagged field to indicate that this is a "flexible" message
  8. // type.
  9. _ struct{} `kafka:"min=v3,max=v3,tag"`
  10. TransactionalID string `kafka:"min=v0,max=v2|min=v3,max=v3,compact"`
  11. GroupID string `kafka:"min=v0,max=v2|min=v3,max=v3,compact"`
  12. ProducerID int64 `kafka:"min=v0,max=v3"`
  13. ProducerEpoch int16 `kafka:"min=v0,max=v3"`
  14. GenerationID int32 `kafka:"min=v3,max=v3"`
  15. MemberID string `kafka:"min=v3,max=v3,compact"`
  16. GroupInstanceID string `kafka:"min=v3,max=v3,compact,nullable"`
  17. Topics []RequestTopic `kafka:"min=v0,max=v3"`
  18. }
  19. type RequestTopic struct {
  20. // We need at least one tagged field to indicate that this is a "flexible" message
  21. // type.
  22. _ struct{} `kafka:"min=v3,max=v3,tag"`
  23. Name string `kafka:"min=v0,max=v2|min=v3,max=v3,compact"`
  24. Partitions []RequestPartition `kafka:"min=v0,max=v3"`
  25. }
  26. type RequestPartition struct {
  27. // We need at least one tagged field to indicate that this is a "flexible" message
  28. // type.
  29. _ struct{} `kafka:"min=v3,max=v3,tag"`
  30. Partition int32 `kafka:"min=v0,max=v3"`
  31. CommittedOffset int64 `kafka:"min=v0,max=v3"`
  32. CommittedLeaderEpoch int32 `kafka:"min=v2,max=v3"`
  33. CommittedMetadata string `kafka:"min=v0,max=v2|min=v3,max=v3,nullable,compact"`
  34. }
  35. func (r *Request) ApiKey() protocol.ApiKey { return protocol.TxnOffsetCommit }
  36. func (r *Request) Group() string { return r.GroupID }
  37. var _ protocol.GroupMessage = (*Request)(nil)
  38. type Response struct {
  39. // We need at least one tagged field to indicate that this is a "flexible" message
  40. // type.
  41. _ struct{} `kafka:"min=v3,max=v3,tag"`
  42. ThrottleTimeMs int32 `kafka:"min=v0,max=v3"`
  43. Topics []ResponseTopic `kafka:"min=v0,max=v3"`
  44. }
  45. type ResponseTopic struct {
  46. // We need at least one tagged field to indicate that this is a "flexible" message
  47. // type.
  48. _ struct{} `kafka:"min=v3,max=v3,tag"`
  49. Name string `kafka:"min=v0,max=v2|min=v3,max=v3,compact"`
  50. Partitions []ResponsePartition `kafka:"min=v0,max=v3"`
  51. }
  52. type ResponsePartition struct {
  53. // We need at least one tagged field to indicate that this is a "flexible" message
  54. // type.
  55. _ struct{} `kafka:"min=v3,max=v3,tag"`
  56. Partition int32 `kafka:"min=v0,max=v3"`
  57. ErrorCode int16 `kafka:"min=v0,max=v3"`
  58. }
  59. func (r *Response) ApiKey() protocol.ApiKey { return protocol.TxnOffsetCommit }