MCPcopy Create free account
hub / github.com/cortexproject/cortex / GetInstanceDescsForOperation

Method GetInstanceDescsForOperation

pkg/ring/ring.go:512–529  ·  view source on GitHub ↗

GetInstanceDescsForOperation implements ReadRing.

(op Operation)

Source from the content-addressed store, hash-verified

510
511// GetInstanceDescsForOperation implements ReadRing.
512func (r *Ring) GetInstanceDescsForOperation(op Operation) (map[string]InstanceDesc, error) {
513 r.mtx.RLock()
514 defer r.mtx.RUnlock()
515
516 if r.ringDesc == nil || len(r.ringDesc.Ingesters) == 0 {
517 return map[string]InstanceDesc{}, ErrEmptyRing
518 }
519
520 storageLastUpdate := r.KVClient.LastUpdateTime(r.key)
521 instanceDescs := make(map[string]InstanceDesc, 0)
522 for id, instance := range r.ringDesc.Ingesters {
523 if r.IsHealthy(&instance, op, storageLastUpdate) {
524 instanceDescs[id] = instance
525 }
526 }
527
528 return instanceDescs, nil
529}
530
531// GetReplicationSetForOperation implements ReadRing.
532func (r *Ring) GetReplicationSetForOperation(op Operation) (ReplicationSet, error) {

Callers 1

Calls 2

IsHealthyMethod · 0.95
LastUpdateTimeMethod · 0.65

Tested by 1