ownersByPartition returns a map where the key is the partition ID and the value is a list of owner IDs.
()
| 124 | |
| 125 | // ownersByPartition returns a map where the key is the partition ID and the value is a list of owner IDs. |
| 126 | func (m *PartitionRingDesc) ownersByPartition() map[int32][]string { |
| 127 | out := make(map[int32][]string, len(m.Partitions)) |
| 128 | for id, o := range m.Owners { |
| 129 | out[o.OwnedPartition] = append(out[o.OwnedPartition], id) |
| 130 | } |
| 131 | |
| 132 | // Sort owners to have predictable tests. |
| 133 | for id := range out { |
| 134 | slices.Sort(out[id]) |
| 135 | } |
| 136 | |
| 137 | return out |
| 138 | } |
| 139 | |
| 140 | // countPartitionsByState returns a map containing the number of partitions by state. |
| 141 | func (m *PartitionRingDesc) countPartitionsByState() map[PartitionState]int { |
no outgoing calls