alterpartitionreassignments.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package alterpartitionreassignments
  2. import "github.com/segmentio/kafka-go/protocol"
  3. func init() {
  4. protocol.Register(&Request{}, &Response{})
  5. }
  6. // Detailed API definition: https://kafka.apache.org/protocol#The_Messages_AlterPartitionReassignments
  7. type Request struct {
  8. // We need at least one tagged field to indicate that this is a "flexible" message
  9. // type.
  10. _ struct{} `kafka:"min=v0,max=v0,tag"`
  11. TimeoutMs int32 `kafka:"min=v0,max=v0"`
  12. Topics []RequestTopic `kafka:"min=v0,max=v0"`
  13. }
  14. type RequestTopic struct {
  15. Name string `kafka:"min=v0,max=v0"`
  16. Partitions []RequestPartition `kafka:"min=v0,max=v0"`
  17. }
  18. type RequestPartition struct {
  19. PartitionIndex int32 `kafka:"min=v0,max=v0"`
  20. Replicas []int32 `kafka:"min=v0,max=v0"`
  21. }
  22. func (r *Request) ApiKey() protocol.ApiKey {
  23. return protocol.AlterPartitionReassignments
  24. }
  25. func (r *Request) Broker(cluster protocol.Cluster) (protocol.Broker, error) {
  26. return cluster.Brokers[cluster.Controller], nil
  27. }
  28. type Response struct {
  29. // We need at least one tagged field to indicate that this is a "flexible" message
  30. // type.
  31. _ struct{} `kafka:"min=v0,max=v0,tag"`
  32. ThrottleTimeMs int32 `kafka:"min=v0,max=v0"`
  33. ErrorCode int16 `kafka:"min=v0,max=v0"`
  34. ErrorMessage string `kafka:"min=v0,max=v0,nullable"`
  35. Results []ResponseResult `kafka:"min=v0,max=v0"`
  36. }
  37. type ResponseResult struct {
  38. Name string `kafka:"min=v0,max=v0"`
  39. Partitions []ResponsePartition `kafka:"min=v0,max=v0"`
  40. }
  41. type ResponsePartition struct {
  42. PartitionIndex int32 `kafka:"min=v0,max=v0"`
  43. ErrorCode int16 `kafka:"min=v0,max=v0"`
  44. ErrorMessage string `kafka:"min=v0,max=v0,nullable"`
  45. }
  46. func (r *Response) ApiKey() protocol.ApiKey {
  47. return protocol.AlterPartitionReassignments
  48. }