MCPcopy
hub / github.com/kubernetes/client-go / NewReflector

Function NewReflector

tools/cache/reflector.go:97–99  ·  view source on GitHub ↗

NewReflector creates a new Reflector object which will keep the given store up to date with the server's contents for the given resource. Reflector promises to only put things in the store that have the type of expectedType, unless expectedType is nil. If resyncPeriod is non-zero, then lists will be

(lw ListerWatcher, expectedType interface{}, store Store, resyncPeriod time.Duration)

Source from the content-addressed store, hash-verified

95// resyncPeriod, so that you can use reflectors to periodically process everything as
96// well as incrementally processing the things that change.
97func NewReflector(lw ListerWatcher, expectedType interface{}, store Store, resyncPeriod time.Duration) *Reflector {
98 return NewNamedReflector(naming.GetNameFromCallsite(internalPackages...), lw, expectedType, store, resyncPeriod)
99}
100
101// NewNamedReflector same as NewReflector, but with a specified name for logging
102func NewNamedReflector(name string, lw ListerWatcher, expectedType interface{}, store Store, resyncPeriod time.Duration) *Reflector {

Callers 13

TestRunUntilFunction · 0.85
TestReflectorResyncChanFunction · 0.85
TestReflectorStopWatchFunction · 0.85
TestReflectorResyncFunction · 0.85
RunMethod · 0.85

Calls 1

NewNamedReflectorFunction · 0.85

Tested by 11

TestRunUntilFunction · 0.68
TestReflectorResyncChanFunction · 0.68
TestReflectorStopWatchFunction · 0.68
TestReflectorResyncFunction · 0.68