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

Method loop

ring/ring.go:395–411  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

393}
394
395func (r *Ring) loop(ctx context.Context) error {
396 // Update the ring metrics at start of the main loop.
397 r.mtx.Lock()
398 r.updateRingMetrics()
399 r.mtx.Unlock()
400
401 r.KVClient.WatchKey(ctx, r.key, func(value interface{}) bool {
402 if value == nil {
403 level.Info(r.logger).Log("msg", "ring doesn't exist in KV store yet")
404 return true
405 }
406
407 r.updateRingState(value.(*Desc))
408 return true
409 })
410 return nil
411}
412
413func (r *Ring) updateRingState(ringDesc *Desc) {
414 r.mtx.RLock()

Callers

nothing calls this directly

Calls 4

updateRingMetricsMethod · 0.95
updateRingStateMethod · 0.95
WatchKeyMethod · 0.65
LogMethod · 0.45

Tested by

no test coverage detected