Set adds or updates partitions for a topic to the topics set. If no partitions are added, this still creates the topic.
(t string, ps ...partitionInfo)
| 42 | // Set adds or updates partitions for a topic to the topics set. If no partitions are |
| 43 | // added, this still creates the topic. |
| 44 | func (ts *topicsSetWithLogDirs) Set(t string, ps ...partitionInfo) { |
| 45 | if *ts == nil { |
| 46 | *ts = make(map[string]map[int32]partitionInfo) |
| 47 | } |
| 48 | existing := (*ts)[t] |
| 49 | if existing == nil { |
| 50 | existing = make(map[int32]partitionInfo, len(ps)) |
| 51 | (*ts)[t] = existing |
| 52 | } |
| 53 | for _, p := range ps { |
| 54 | existing[p.PartitionID] = p |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | // EachPartition calls fn for each partition in any directory. |
| 59 | func (ts topicsSetWithLogDirs) EachPartition(fn func(p partitionInfo)) { |
no outgoing calls