MCPcopy Index your code
hub / github.com/PatchMon/PatchMon / forEachDB

Function forEachDB

server-source-code/internal/queue/workers.go:69–81  ·  view source on GitHub ↗

forEachDB calls fn for the defaultDB and then for every context DB in the poolCache. When there is no poolCache (single-context), only defaultDB is processed. The tenantHost passed to fn is the domain (Entry.Host), matching TenantKey's prefix.

(ctx context.Context, defaultDB *database.DB, poolCache *hostctx.PoolCache, fn func(context.Context, *database.DB, string))

Source from the content-addressed store, hash-verified

67// When there is no poolCache (single-context), only defaultDB is processed.
68// The tenantHost passed to fn is the domain (Entry.Host), matching TenantKey's prefix.
69func forEachDB(ctx context.Context, defaultDB *database.DB, poolCache *hostctx.PoolCache, fn func(context.Context, *database.DB, string)) {
70 fn(ctx, defaultDB, "")
71 if poolCache == nil {
72 return
73 }
74 for _, host := range poolCache.ListHosts() {
75 d, err := poolCache.GetOrCreate(ctx, host)
76 if err != nil || d == nil {
77 continue
78 }
79 fn(ctx, d, host)
80 }
81}
82
83// HostStatusMonitorHandler handles host-status-monitor jobs.
84type HostStatusMonitorHandler struct {

Callers 11

ProcessTaskMethod · 0.85
ProcessTaskMethod · 0.85
ProcessTaskMethod · 0.85
ProcessTaskMethod · 0.85
ProcessTaskMethod · 0.85
ProcessTaskMethod · 0.85
ProcessTaskMethod · 0.85
ProcessTaskMethod · 0.85
ProcessTaskMethod · 0.85
ProcessTaskMethod · 0.85
ProcessTaskMethod · 0.85

Calls 2

ListHostsMethod · 0.65
GetOrCreateMethod · 0.45

Tested by

no test coverage detected