(ctx context.Context)
| 73 | } |
| 74 | |
| 75 | func (w *PartitionRingWatcher) starting(ctx context.Context) error { |
| 76 | // Get the initial ring state so that, as soon as the service will be running, the in-memory |
| 77 | // ring would be already populated and there's no race condition between when the service is |
| 78 | // running and the WatchKey() callback is called for the first time. |
| 79 | value, err := w.kv.Get(ctx, w.key) |
| 80 | if err != nil { |
| 81 | return errors.Wrap(err, "unable to initialise ring state") |
| 82 | } |
| 83 | |
| 84 | if value == nil { |
| 85 | level.Info(w.logger).Log("msg", "partition ring doesn't exist in KV store yet") |
| 86 | value = NewPartitionRingDesc() |
| 87 | } |
| 88 | |
| 89 | return w.updatePartitionRing(value.(*PartitionRingDesc)) |
| 90 | } |
| 91 | |
| 92 | func (w *PartitionRingWatcher) loop(ctx context.Context) error { |
| 93 | var watchErr error |
nothing calls this directly
no test coverage detected