MCPcopy
hub / github.com/cilium/ebpf / LookupAndDeleteWithFlags

Method LookupAndDeleteWithFlags

map.go:878–888  ·  view source on GitHub ↗

LookupAndDeleteWithFlags retrieves and deletes a value from a Map. Passing LookupLock flag will look up and delete the value of a spin-locked map without returning the lock. This must be specified if the elements contain a spinlock. Returns ErrKeyNotExist if the key doesn't exist.

(key, valueOut any, flags MapLookupFlags)

Source from the content-addressed store, hash-verified

876//
877// Returns ErrKeyNotExist if the key doesn't exist.
878func (m *Map) LookupAndDeleteWithFlags(key, valueOut any, flags MapLookupFlags) error {
879 if m.typ.hasPerCPUValue() {
880 return m.lookupAndDeletePerCPU(key, valueOut, flags)
881 }
882
883 valueBytes := makeMapSyscallOutput(valueOut, m.fullValueSize)
884 if err := m.lookupAndDelete(key, valueBytes.Pointer(), flags); err != nil {
885 return err
886 }
887 return m.unmarshalValue(valueOut, valueBytes)
888}
889
890// LookupBytes gets a value from Map.
891//

Callers 2

LookupAndDeleteMethod · 0.95
TestMapWithLockFunction · 0.80

Calls 6

lookupAndDeletePerCPUMethod · 0.95
lookupAndDeleteMethod · 0.95
unmarshalValueMethod · 0.95
makeMapSyscallOutputFunction · 0.85
hasPerCPUValueMethod · 0.80
PointerMethod · 0.80

Tested by 1

TestMapWithLockFunction · 0.64