(brokers map[int32]Broker, topicMetadata []topicMetadataV1)
| 1030 | } |
| 1031 | |
| 1032 | func (c *Conn) readTopicMetadatav1(brokers map[int32]Broker, topicMetadata []topicMetadataV1) (partitions []Partition, err error) { |
| 1033 | for _, t := range topicMetadata { |
| 1034 | if t.TopicErrorCode != 0 && (c.topic == "" || t.TopicName == c.topic) { |
| 1035 | // We only report errors if they happened for the topic of |
| 1036 | // the connection, otherwise the topic will simply have no |
| 1037 | // partitions in the result set. |
| 1038 | return nil, Error(t.TopicErrorCode) |
| 1039 | } |
| 1040 | for _, p := range t.Partitions { |
| 1041 | partitions = append(partitions, Partition{ |
| 1042 | Topic: t.TopicName, |
| 1043 | Leader: brokers[p.Leader], |
| 1044 | Replicas: makeBrokers(brokers, p.Replicas...), |
| 1045 | Isr: makeBrokers(brokers, p.Isr...), |
| 1046 | ID: int(p.PartitionID), |
| 1047 | OfflineReplicas: []Broker{}, |
| 1048 | }) |
| 1049 | } |
| 1050 | } |
| 1051 | return |
| 1052 | } |
| 1053 | |
| 1054 | func (c *Conn) readTopicMetadatav6(brokers map[int32]Broker, topicMetadata []topicMetadataV6) (partitions []Partition, err error) { |
| 1055 | for _, t := range topicMetadata { |
no test coverage detected