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

Method loop

ring/partition_ring_watcher.go:92–107  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

90}
91
92func (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
109func (w *PartitionRingWatcher) updatePartitionRing(desc *PartitionRingDesc) error {
110 newRing, err := NewPartitionRingWithOptions(*desc, w.opts)

Callers

nothing calls this directly

Calls 3

updatePartitionRingMethod · 0.95
WatchKeyMethod · 0.65
LogMethod · 0.45

Tested by

no test coverage detected