ActivePartitionIDs returns a sorted list of all ACTIVE partition IDs in the ring. The returned slice is a copy, so the caller can freely manipulate it.
()
| 382 | // ActivePartitionIDs returns a sorted list of all ACTIVE partition IDs in the ring. |
| 383 | // The returned slice is a copy, so the caller can freely manipulate it. |
| 384 | func (r *PartitionRing) ActivePartitionIDs() []int32 { |
| 385 | ids := make([]int32, 0, len(r.desc.Partitions)) |
| 386 | |
| 387 | for id, partition := range r.desc.Partitions { |
| 388 | if partition.IsActive() { |
| 389 | ids = append(ids, id) |
| 390 | } |
| 391 | } |
| 392 | |
| 393 | slices.Sort(ids) |
| 394 | return ids |
| 395 | } |
| 396 | |
| 397 | // InactivePartitionIDs returns a sorted list of all INACTIVE partition IDs in the ring. |
| 398 | // The returned slice is a copy, so the caller can freely manipulate it. |