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

Method starting

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

Source from the content-addressed store, hash-verified

73}
74
75func (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
92func (w *PartitionRingWatcher) loop(ctx context.Context) error {
93 var watchErr error

Callers

nothing calls this directly

Calls 5

updatePartitionRingMethod · 0.95
NewPartitionRingDescFunction · 0.85
GetMethod · 0.65
WrapMethod · 0.65
LogMethod · 0.45

Tested by

no test coverage detected