MCPcopy Create free account
hub / github.com/stakater/Reloader / storeSelectedNamespaces

Function storeSelectedNamespaces

internal/pkg/controller/controller.go:71–77  ·  view source on GitHub ↗

storeSelectedNamespaces replaces the current snapshot with one built from ns. It is the only mutator of selectedNamespacesCache and is called only from the namespace controller's informer goroutine (or from tests for setup).

(ns []string)

Source from the content-addressed store, hash-verified

69// It is the only mutator of selectedNamespacesCache and is called only from
70// the namespace controller's informer goroutine (or from tests for setup).
71func storeSelectedNamespaces(ns []string) {
72 m := make(map[string]struct{}, len(ns))
73 for _, n := range ns {
74 m[n] = struct{}{}
75 }
76 selectedNamespacesCache.Store(m)
77}
78
79// loadSelectedNamespacesList returns the current namespace names as a slice.
80// Intended for use in tests where slice-based assertions are more convenient.

Calls

no outgoing calls

Tested by 5

resetGlobalStateFunction · 0.68
TestUpdateHandlerFunction · 0.68