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

Function SimpleRing

ring/example/local/local.go:195–208  ·  view source on GitHub ↗

SimpleRing returns an instance of `ring.Ring` as a service. Starting and stopping the service is up to the caller.

(store kv.Client)

Source from the content-addressed store, hash-verified

193
194// SimpleRing returns an instance of `ring.Ring` as a service. Starting and stopping the service is up to the caller.
195func SimpleRing(store kv.Client) (*ring.Ring, error) {
196 var config ring.Config
197 flagext.DefaultValues(&config)
198
199 return ring.NewWithStoreClientAndStrategy(
200 config,
201 "local", // ring name
202 "collectors/ring", // prefix key where peers are stored
203 store,
204 ring.NewDefaultReplicationStrategy(),
205 prometheus.NewPedanticRegistry(),
206 log.With(logger, "component", "ring"),
207 )
208}
209
210// SimpleRingLifecycler returns an instance lifecycler for the given `kv.Client`.
211// Usually lifecycler will be part of the server side that act as a single peer.

Callers 1

runClientFunction · 0.85

Calls 4

DefaultValuesFunction · 0.92
WithMethod · 0.80

Tested by

no test coverage detected