metadata.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package metadata
  2. import "github.com/segmentio/kafka-go/protocol"
  3. func init() {
  4. protocol.Register(&Request{}, &Response{})
  5. }
  6. type Request struct {
  7. TopicNames []string `kafka:"min=v0,max=v8,nullable"`
  8. AllowAutoTopicCreation bool `kafka:"min=v4,max=v8"`
  9. IncludeClusterAuthorizedOperations bool `kafka:"min=v8,max=v8"`
  10. IncludeTopicAuthorizedOperations bool `kafka:"min=v8,max=v8"`
  11. }
  12. func (r *Request) ApiKey() protocol.ApiKey { return protocol.Metadata }
  13. type Response struct {
  14. ThrottleTimeMs int32 `kafka:"min=v3,max=v8"`
  15. Brokers []ResponseBroker `kafka:"min=v0,max=v8"`
  16. ClusterID string `kafka:"min=v2,max=v8,nullable"`
  17. ControllerID int32 `kafka:"min=v1,max=v8"`
  18. Topics []ResponseTopic `kafka:"min=v0,max=v8"`
  19. ClusterAuthorizedOperations int32 `kafka:"min=v8,max=v8"`
  20. }
  21. func (r *Response) ApiKey() protocol.ApiKey { return protocol.Metadata }
  22. type ResponseBroker struct {
  23. NodeID int32 `kafka:"min=v0,max=v8"`
  24. Host string `kafka:"min=v0,max=v8"`
  25. Port int32 `kafka:"min=v0,max=v8"`
  26. Rack string `kafka:"min=v1,max=v8,nullable"`
  27. }
  28. type ResponseTopic struct {
  29. ErrorCode int16 `kafka:"min=v0,max=v8"`
  30. Name string `kafka:"min=v0,max=v8"`
  31. IsInternal bool `kafka:"min=v1,max=v8"`
  32. Partitions []ResponsePartition `kafka:"min=v0,max=v8"`
  33. TopicAuthorizedOperations int32 `kafka:"min=v8,max=v8"`
  34. }
  35. type ResponsePartition struct {
  36. ErrorCode int16 `kafka:"min=v0,max=v8"`
  37. PartitionIndex int32 `kafka:"min=v0,max=v8"`
  38. LeaderID int32 `kafka:"min=v0,max=v8"`
  39. LeaderEpoch int32 `kafka:"min=v7,max=v8"`
  40. ReplicaNodes []int32 `kafka:"min=v0,max=v8"`
  41. IsrNodes []int32 `kafka:"min=v0,max=v8"`
  42. OfflineReplicas []int32 `kafka:"min=v5,max=v8"`
  43. }