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

Method Delete

tools/cache/heap.go:223–235  ·  view source on GitHub ↗

Delete removes an item.

(obj interface{})

Source from the content-addressed store, hash-verified

221
222// Delete removes an item.
223func (h *Heap) Delete(obj interface{}) error {
224 key, err := h.data.keyFunc(obj)
225 if err != nil {
226 return KeyError{obj, err}
227 }
228 h.lock.Lock()
229 defer h.lock.Unlock()
230 if item, ok := h.data.items[key]; ok {
231 heap.Remove(h.data, item.index)
232 return nil
233 }
234 return fmt.Errorf("object not found")
235}
236
237// Pop waits until an item is ready. If multiple items are
238// ready, they are returned in the order given by Heap.data.lessFunc.

Callers 2

TestHeap_AddFunction · 0.95
TestHeap_DeleteFunction · 0.95

Calls 1

ErrorfMethod · 0.65

Tested by 2

TestHeap_AddFunction · 0.76
TestHeap_DeleteFunction · 0.76