MCPcopy Create free account
hub / github.com/cloudbase/garm / InitWatcher

Function InitWatcher

database/watcher/watcher.go:29–43  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

27var databaseWatcher common.Watcher
28
29func InitWatcher(ctx context.Context) {
30 if databaseWatcher != nil {
31 return
32 }
33 ctx = garmUtil.WithSlogContext(ctx, slog.Any("watcher", "database"))
34 w := &watcher{
35 producers: make(map[string]*producer),
36 consumers: make(map[string]*consumer),
37 quit: make(chan struct{}),
38 ctx: ctx,
39 }
40
41 go w.loop()
42 databaseWatcher = w
43}
44
45func CloseWatcher() error {
46 if databaseWatcher == nil {

Callers 15

SetupTestMethod · 0.92
SetupTestMethod · 0.92
SetupTestMethod · 0.92
SetupTestMethod · 0.92
SetupTestMethod · 0.92
SetupTestMethod · 0.92
SetupTestMethod · 0.92
SetupTestMethod · 0.92
SetupTestMethod · 0.92
SetupTestMethod · 0.92
SetupTestMethod · 0.92

Calls 1

loopMethod · 0.95

Tested by 15

SetupTestMethod · 0.74
SetupTestMethod · 0.74
SetupTestMethod · 0.74
SetupTestMethod · 0.74
SetupTestMethod · 0.74
SetupTestMethod · 0.74
SetupTestMethod · 0.74
SetupTestMethod · 0.74
SetupTestMethod · 0.74
SetupTestMethod · 0.74
SetupTestMethod · 0.74