(ctx context.Context)
| 90 | } |
| 91 | |
| 92 | func (w *PartitionRingWatcher) loop(ctx context.Context) error { |
| 93 | var watchErr error |
| 94 | w.kv.WatchKey(ctx, w.key, func(value interface{}) bool { |
| 95 | if value == nil { |
| 96 | level.Info(w.logger).Log("msg", "partition ring doesn't exist in KV store yet") |
| 97 | return true |
| 98 | } |
| 99 | |
| 100 | if err := w.updatePartitionRing(value.(*PartitionRingDesc)); err != nil { |
| 101 | watchErr = err |
| 102 | return false |
| 103 | } |
| 104 | return true |
| 105 | }) |
| 106 | return watchErr |
| 107 | } |
| 108 | |
| 109 | func (w *PartitionRingWatcher) updatePartitionRing(desc *PartitionRingDesc) error { |
| 110 | newRing, err := NewPartitionRingWithOptions(*desc, w.opts) |
nothing calls this directly
no test coverage detected