MCPcopy
hub / github.com/segmentio/kafka-go / extractTopics

Function extractTopics

reader.go:1585–1603  ·  view source on GitHub ↗

extractTopics returns the unique list of topics represented by the set of provided members.

(members []GroupMember)

Source from the content-addressed store, hash-verified

1583// extractTopics returns the unique list of topics represented by the set of
1584// provided members.
1585func extractTopics(members []GroupMember) []string {
1586 visited := map[string]struct{}{}
1587 var topics []string
1588
1589 for _, member := range members {
1590 for _, topic := range member.Topics {
1591 if _, seen := visited[topic]; seen {
1592 continue
1593 }
1594
1595 topics = append(topics, topic)
1596 visited[topic] = struct{}{}
1597 }
1598 }
1599
1600 sort.Strings(topics)
1601
1602 return topics
1603}
1604
1605type humanOffset int64
1606

Callers 2

TestExtractTopicsFunction · 0.85
assignTopicPartitionsMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestExtractTopicsFunction · 0.68