MCPcopy
hub / github.com/grafana/dskit / ownersByPartition

Method ownersByPartition

ring/partition_ring_model.go:126–138  ·  view source on GitHub ↗

ownersByPartition returns a map where the key is the partition ID and the value is a list of owner IDs.

()

Source from the content-addressed store, hash-verified

124
125// ownersByPartition returns a map where the key is the partition ID and the value is a list of owner IDs.
126func (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.
141func (m *PartitionRingDesc) countPartitionsByState() map[PartitionState]int {

Calls

no outgoing calls