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

Function NewRing

servicediscovery/ring.go:32–44  ·  view source on GitHub ↗
(ringClient *ring.Ring, ringCheckPeriod time.Duration, maxUsedInstances int, receiver Notifications)

Source from the content-addressed store, hash-verified

30}
31
32func NewRing(ringClient *ring.Ring, ringCheckPeriod time.Duration, maxUsedInstances int, receiver Notifications) services.Service {
33 r := &ringServiceDiscovery{
34 ringClient: ringClient,
35 ringCheckPeriod: ringCheckPeriod,
36 maxUsedInstances: maxUsedInstances,
37 subservicesWatcher: services.NewFailureWatcher(),
38 notifiedByAddress: make(map[string]Instance),
39 receiver: receiver,
40 }
41
42 r.Service = services.NewBasicService(r.starting, r.running, r.stopping)
43 return r
44}
45
46func (r *ringServiceDiscovery) starting(ctx context.Context) error {
47 r.subservicesWatcher.WatchService(r.ringClient)

Calls 2

NewFailureWatcherFunction · 0.92
NewBasicServiceFunction · 0.92