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

Method addIfNotPresent

tools/cache/delta_fifo.go:248–257  ·  view source on GitHub ↗

addIfNotPresent inserts deltas under id if it does not exist, and assumes the caller already holds the fifo lock.

(id string, deltas Deltas)

Source from the content-addressed store, hash-verified

246// addIfNotPresent inserts deltas under id if it does not exist, and assumes the caller
247// already holds the fifo lock.
248func (f *DeltaFIFO) addIfNotPresent(id string, deltas Deltas) {
249 f.populated = true
250 if _, exists := f.items[id]; exists {
251 return
252 }
253
254 f.queue = append(f.queue, id)
255 f.items[id] = deltas
256 f.cond.Broadcast()
257}
258
259// re-listing and watching can deliver the same update multiple times in any
260// order. This will combine the most recent two deltas if they are the same.

Callers 2

AddIfNotPresentMethod · 0.95
PopMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected