addpartitionstotxn.go 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. package addpartitionstotxn
  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. ProducerID int64 `kafka:"min=v0,max=v3"`
  12. ProducerEpoch int16 `kafka:"min=v0,max=v3"`
  13. Topics []RequestTopic `kafka:"min=v0,max=v3"`
  14. }
  15. type RequestTopic struct {
  16. // We need at least one tagged field to indicate that this is a "flexible" message
  17. // type.
  18. _ struct{} `kafka:"min=v3,max=v3,tag"`
  19. Name string `kafka:"min=v0,max=v2|min=v3,max=v3,compact"`
  20. Partitions []int32 `kafka:"min=v0,max=v3"`
  21. }
  22. func (r *Request) ApiKey() protocol.ApiKey { return protocol.AddPartitionsToTxn }
  23. func (r *Request) Transaction() string { return r.TransactionalID }
  24. var _ protocol.TransactionalMessage = (*Request)(nil)
  25. type Response struct {
  26. // We need at least one tagged field to indicate that this is a "flexible" message
  27. // type.
  28. _ struct{} `kafka:"min=v3,max=v3,tag"`
  29. ThrottleTimeMs int32 `kafka:"min=v0,max=v3"`
  30. Results []ResponseResult `kafka:"min=v0,max=v3"`
  31. }
  32. type ResponseResult struct {
  33. // We need at least one tagged field to indicate that this is a "flexible" message
  34. // type.
  35. _ struct{} `kafka:"min=v3,max=v3,tag"`
  36. Name string `kafka:"min=v0,max=v2|min=v3,max=v3,compact"`
  37. Results []ResponsePartition `kafka:"min=v0,max=v3"`
  38. }
  39. type ResponsePartition struct {
  40. // We need at least one tagged field to indicate that this is a "flexible" message
  41. // type.
  42. _ struct{} `kafka:"min=v3,max=v3,tag"`
  43. PartitionIndex int32 `kafka:"min=v0,max=v3"`
  44. ErrorCode int16 `kafka:"min=v0,max=v3"`
  45. }
  46. func (r *Response) ApiKey() protocol.ApiKey { return protocol.AddPartitionsToTxn }