(ctx context.Context)
| 286 | } |
| 287 | |
| 288 | func (r *Ring) starting(ctx context.Context) error { |
| 289 | // Get the initial ring state so that, as soon as the service will be running, the in-memory |
| 290 | // ring would be already populated and there's no race condition between when the service is |
| 291 | // running and the WatchKey() callback is called for the first time. |
| 292 | value, err := r.KVClient.Get(ctx, r.key) |
| 293 | if err != nil { |
| 294 | return errors.Wrap(err, "unable to initialise ring state") |
| 295 | } |
| 296 | if value != nil { |
| 297 | r.updateRingState(value.(*Desc)) |
| 298 | } else { |
| 299 | level.Info(r.logger).Log("msg", "ring doesn't exist in KV store yet") |
| 300 | } |
| 301 | return nil |
| 302 | } |
| 303 | |
| 304 | func (r *Ring) loop(ctx context.Context) error { |
| 305 | // Update the ring metrics at start of the main loop. |
nothing calls this directly
no test coverage detected