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

Method WatchService

services/failure_watcher.go:37–55  ·  view source on GitHub ↗
(service Service)

Source from the content-addressed store, hash-verified

35}
36
37func (w *FailureWatcher) WatchService(service Service) {
38 // Ensure that if the caller request to watch a service, then the FailureWatcher
39 // has been initialized.
40 if w == nil {
41 panic(errFailureWatcherNotInitialized)
42 }
43
44 w.mu.Lock()
45 defer w.mu.Unlock()
46
47 if w.closed {
48 panic(errFailureWatcherClosed)
49 }
50
51 stop := service.AddListener(NewListener(nil, nil, nil, nil, func(_ State, failure error) {
52 w.ch <- errors.Wrapf(failure, "service %s failed", DescribeService(service))
53 }))
54 w.unregisterListeners = append(w.unregisterListeners, stop)
55}
56
57func (w *FailureWatcher) WatchManager(manager *Manager) {
58 // Ensure that if the caller request to watch services, then the FailureWatcher

Callers 6

GetMemberlistKVMethod · 0.80
startingMethod · 0.80

Calls 3

NewListenerFunction · 0.85
DescribeServiceFunction · 0.85
AddListenerMethod · 0.65