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

Method starting

ring/ring.go:379–393  ·  ring/ring.go::Ring.starting
(ctx context.Context)

Source from the content-addressed store, hash-verified

377}
378
379func (r *Ring) starting(ctx context.Context) error {
380 // Get the initial ring state so that, as soon as the service will be running, the in-memory
381 // ring would be already populated and there's no race condition between when the service is
382 // running and the WatchKey() callback is called for the first time.
383 value, err := r.KVClient.Get(ctx, r.key)
384 if err != nil {
385 return errors.Wrap(err, "unable to initialise ring state")
386 }
387 if value != nil {
388 r.updateRingState(value.(*Desc))
389 } else {
390 level.Info(r.logger).Log("msg", "ring doesn't exist in KV store yet")
391 }
392 return nil
393}
394
395func (r *Ring) loop(ctx context.Context) error {
396 // Update the ring metrics at start of the main loop.

Callers

nothing calls this directly

Calls 4

updateRingStateMethod · 0.95
GetMethod · 0.65
WrapMethod · 0.65
LogMethod · 0.45

Tested by

no test coverage detected