countPartitionsByState returns a map containing the number of partitions by state.
()
| 139 | |
| 140 | // countPartitionsByState returns a map containing the number of partitions by state. |
| 141 | func (m *PartitionRingDesc) countPartitionsByState() map[PartitionState]int { |
| 142 | // Init the map to have to zero values for all states. |
| 143 | out := make(map[PartitionState]int, len(PartitionState_value)-2) |
| 144 | for _, state := range PartitionState_value { |
| 145 | if PartitionState(state) == PartitionUnknown || PartitionState(state) == PartitionDeleted { |
| 146 | continue |
| 147 | } |
| 148 | |
| 149 | out[PartitionState(state)] = 0 |
| 150 | } |
| 151 | |
| 152 | for _, partition := range m.Partitions { |
| 153 | out[partition.State]++ |
| 154 | } |
| 155 | |
| 156 | return out |
| 157 | } |
| 158 | |
| 159 | func (m *PartitionRingDesc) activePartitionsCount() int { |
| 160 | count := 0 |