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

Method KeyOf

tools/cache/delta_fifo.go:150–161  ·  view source on GitHub ↗

KeyOf exposes f's keyFunc, but also detects the key of a Deltas object or DeletedFinalStateUnknown objects.

(obj interface{})

Source from the content-addressed store, hash-verified

148// KeyOf exposes f's keyFunc, but also detects the key of a Deltas object or
149// DeletedFinalStateUnknown objects.
150func (f *DeltaFIFO) KeyOf(obj interface{}) (string, error) {
151 if d, ok := obj.(Deltas); ok {
152 if len(d) == 0 {
153 return "", KeyError{obj, ErrZeroLengthDeltasObject}
154 }
155 obj = d.Newest().Object
156 }
157 if d, ok := obj.(DeletedFinalStateUnknown); ok {
158 return d.Key, nil
159 }
160 return f.keyFunc(obj)
161}
162
163// Return true if an Add/Update/Delete/AddIfNotPresent are called first,
164// or an Update called first but the first batch of items inserted by Replace() has been popped

Callers 8

DeleteMethod · 0.95
AddIfNotPresentMethod · 0.95
queueActionLockedMethod · 0.95
GetMethod · 0.95
ReplaceMethod · 0.95
syncKeyLockedMethod · 0.95
TestDeltaFIFO_KeyOfFunction · 0.95
ExampleFunction · 0.95

Calls 1

NewestMethod · 0.80

Tested by 2

TestDeltaFIFO_KeyOfFunction · 0.76
ExampleFunction · 0.76