listpartitionreassignments.go 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. package listpartitionreassignments
  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_ListPartitionReassignments.
  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,nullable"`
  13. }
  14. type RequestTopic struct {
  15. // We need at least one tagged field to indicate that this is a "flexible" message
  16. // type.
  17. _ struct{} `kafka:"min=v0,max=v0,tag"`
  18. Name string `kafka:"min=v0,max=v0"`
  19. PartitionIndexes []int32 `kafka:"min=v0,max=v0"`
  20. }
  21. func (r *Request) ApiKey() protocol.ApiKey {
  22. return protocol.ListPartitionReassignments
  23. }
  24. func (r *Request) Broker(cluster protocol.Cluster) (protocol.Broker, error) {
  25. return cluster.Brokers[cluster.Controller], nil
  26. }
  27. type Response struct {
  28. // We need at least one tagged field to indicate that this is a "flexible" message
  29. // type.
  30. _ struct{} `kafka:"min=v0,max=v0,tag"`
  31. ThrottleTimeMs int32 `kafka:"min=v0,max=v0"`
  32. ErrorCode int16 `kafka:"min=v0,max=v0"`
  33. ErrorMessage string `kafka:"min=v0,max=v0,nullable"`
  34. Topics []ResponseTopic `kafka:"min=v0,max=v0"`
  35. }
  36. type ResponseTopic struct {
  37. // We need at least one tagged field to indicate that this is a "flexible" message
  38. // type.
  39. _ struct{} `kafka:"min=v0,max=v0,tag"`
  40. Name string `kafka:"min=v0,max=v0"`
  41. Partitions []ResponsePartition `kafka:"min=v0,max=v0"`
  42. }
  43. type ResponsePartition struct {
  44. // We need at least one tagged field to indicate that this is a "flexible" message
  45. // type.
  46. _ struct{} `kafka:"min=v0,max=v0,tag"`
  47. PartitionIndex int32 `kafka:"min=v0,max=v0"`
  48. Replicas []int32 `kafka:"min=v0,max=v0"`
  49. AddingReplicas []int32 `kafka:"min=v0,max=v0"`
  50. RemovingReplicas []int32 `kafka:"min=v0,max=v0"`
  51. }
  52. func (r *Response) ApiKey() protocol.ApiKey {
  53. return protocol.ListPartitionReassignments
  54. }