github.com/segmentio/kafka-go@v0.4.48-0.20240318174348-3f6244eb34fd/protocol/listpartitionreassignments/listpartitionreassignments.go (about) 1 package listpartitionreassignments 2 3 import "github.com/segmentio/kafka-go/protocol" 4 5 func init() { 6 protocol.Register(&Request{}, &Response{}) 7 } 8 9 // Detailed API definition: https://kafka.apache.org/protocol#The_Messages_ListPartitionReassignments. 10 11 type Request struct { 12 // We need at least one tagged field to indicate that this is a "flexible" message 13 // type. 14 _ struct{} `kafka:"min=v0,max=v0,tag"` 15 16 TimeoutMs int32 `kafka:"min=v0,max=v0"` 17 Topics []RequestTopic `kafka:"min=v0,max=v0,nullable"` 18 } 19 20 type RequestTopic struct { 21 // We need at least one tagged field to indicate that this is a "flexible" message 22 // type. 23 _ struct{} `kafka:"min=v0,max=v0,tag"` 24 25 Name string `kafka:"min=v0,max=v0"` 26 PartitionIndexes []int32 `kafka:"min=v0,max=v0"` 27 } 28 29 func (r *Request) ApiKey() protocol.ApiKey { 30 return protocol.ListPartitionReassignments 31 } 32 33 func (r *Request) Broker(cluster protocol.Cluster) (protocol.Broker, error) { 34 return cluster.Brokers[cluster.Controller], nil 35 } 36 37 type Response struct { 38 // We need at least one tagged field to indicate that this is a "flexible" message 39 // type. 40 _ struct{} `kafka:"min=v0,max=v0,tag"` 41 42 ThrottleTimeMs int32 `kafka:"min=v0,max=v0"` 43 ErrorCode int16 `kafka:"min=v0,max=v0"` 44 ErrorMessage string `kafka:"min=v0,max=v0,nullable"` 45 Topics []ResponseTopic `kafka:"min=v0,max=v0"` 46 } 47 48 type ResponseTopic struct { 49 // We need at least one tagged field to indicate that this is a "flexible" message 50 // type. 51 _ struct{} `kafka:"min=v0,max=v0,tag"` 52 53 Name string `kafka:"min=v0,max=v0"` 54 Partitions []ResponsePartition `kafka:"min=v0,max=v0"` 55 } 56 57 type ResponsePartition struct { 58 // We need at least one tagged field to indicate that this is a "flexible" message 59 // type. 60 _ struct{} `kafka:"min=v0,max=v0,tag"` 61 62 PartitionIndex int32 `kafka:"min=v0,max=v0"` 63 Replicas []int32 `kafka:"min=v0,max=v0"` 64 AddingReplicas []int32 `kafka:"min=v0,max=v0"` 65 RemovingReplicas []int32 `kafka:"min=v0,max=v0"` 66 } 67 68 func (r *Response) ApiKey() protocol.ApiKey { 69 return protocol.ListPartitionReassignments 70 }