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

Method queueActionLocked

tools/cache/delta_fifo.go:307–335  ·  view source on GitHub ↗

queueActionLocked appends to the delta list for the object. Caller must lock first.

(actionType DeltaType, obj interface{})

Source from the content-addressed store, hash-verified

305// queueActionLocked appends to the delta list for the object.
306// Caller must lock first.
307func (f *DeltaFIFO) queueActionLocked(actionType DeltaType, obj interface{}) error {
308 id, err := f.KeyOf(obj)
309 if err != nil {
310 return KeyError{obj, err}
311 }
312
313 // If object is supposed to be deleted (last event is Deleted),
314 // then we should ignore Sync events, because it would result in
315 // recreation of this object.
316 if actionType == Sync && f.willObjectBeDeletedLocked(id) {
317 return nil
318 }
319
320 newDeltas := append(f.items[id], Delta{actionType, obj})
321 newDeltas = dedupDeltas(newDeltas)
322
323 if len(newDeltas) > 0 {
324 if _, exists := f.items[id]; !exists {
325 f.queue = append(f.queue, id)
326 }
327 f.items[id] = newDeltas
328 f.cond.Broadcast()
329 } else {
330 // We need to remove this from our map (extra items in the queue are
331 // ignored if they are not in the map).
332 delete(f.items, id)
333 }
334 return nil
335}
336
337// List returns a list of all the items; it returns the object
338// from the most recent Delta.

Callers 5

AddMethod · 0.95
UpdateMethod · 0.95
DeleteMethod · 0.95
ReplaceMethod · 0.95
syncKeyLockedMethod · 0.95

Calls 3

KeyOfMethod · 0.95
dedupDeltasFunction · 0.85

Tested by

no test coverage detected