func (pl *ProfileLoader) DeleteMapOfMapsKeyValue(kv *keyvalue.MapOfMapsKeyValue) error {
	byteOrder := utils.GetHostByteOrder()
	// Select map of maps
	mapOfMaps, ok := pl.collection.Maps[kv.MapOfMapsKey.GetMapSection()]
	if !ok {
		return errors.Wrap(errors.New(kv.MapOfMapsKey.GetMapSection()), "unknown map")
	}
	// Generate inner map Key unsafe pointer
	keyPtr, err := kv.MapOfMapsKey.GetKey(byteOrder)
	if err != nil {
		return errors.Wrapf(err, "couldn't create unsafe pointer key for type %s", reflect.TypeOf(kv.MapOfMapsKey))
	}
	// Fetch map id
	innerMapIDB, err := mapOfMaps.GetBytes(keyPtr)
	if err != nil {
		return errors.Wrapf(err, "inner map not found fot type %s", reflect.TypeOf(kv.MapOfMapsKey))
	}
	innerMapID := byteOrder.Uint32(innerMapIDB)
	// Delete inner map entry in the map of maps
	if err := mapOfMaps.Delete(keyPtr); err != nil {
		return errors.Wrapf(err, "failed to delete element in map %s", kv.MapOfMapsKey.GetMapSection())
	}
	// Select inner map name
	// TODO: this should be improved by querying the kernel with a BPF _ObjGetInfoByFD call
	// -> won't work for pinned map after an agent unexpected shut down and restart
	innerMapName, ok := pl.MapIDMapName[innerMapID]
	if !ok {
		return errors.Wrapf(errors.New(kv.MapSectionToClone), "unknown inner map ID %d", innerMapID)
	}
	innerMap, ok := pl.collection.Maps[innerMapName]
	if !ok {
		return errors.Wrapf(errors.New(kv.MapSectionToClone), "unknown inner map name %s", innerMapName)
	}
	// Close inner map
	if err := innerMap.Close(); err != nil {
		return errors.Wrapf(err, "couldn't close inner map for type %s", reflect.TypeOf(kv.MapOfMapsKey))
	}
	// Remove inner map from collection
	delete(pl.collection.Maps, innerMapName)
	// Remove inner map from mapping ID <-> name
	delete(pl.MapIDMapName, innerMapID)
	return nil
}
// DeleteMapOfMapsKeyValue - Deletes a map-of-maps key value in the kernel
Deletes a map-of-maps key value in the kernel
// DeleteMapOfMapsKeyValue - Deletes a map - of - maps key value in the kernel
func (pl *ProfileLoader) DeleteMapOfMapsKeyValue(kv *keyvalue.MapOfMapsKeyValue) error {
	byteOrder := utils.GetHostByteOrder()
	mapOfMaps, ok := pl.collection.Maps[kv.MapOfMapsKey.GetMapSection()]
	if !ok {
		return errors.Wrap(errors.New(kv.MapOfMapsKey.GetMapSection()), "unknown map")
	}
	keyPtr, err := kv.MapOfMapsKey.GetKey(byteOrder)
	if err != nil {
		return errors.Wrapf(err, "couldn't create unsafe pointer key for type %s", reflect.TypeOf(kv.MapOfMapsKey))
	}
	innerMapIDB, err := mapOfMaps.GetBytes(keyPtr)
	if err != nil {
		return errors.Wrapf(err, "inner map not found fot type %s", reflect.TypeOf(kv.MapOfMapsKey))
	}
	innerMapID := byteOrder.Uint32(innerMapIDB)
	if err := mapOfMaps.Delete(keyPtr); err != nil {
		return errors.Wrapf(err, "failed to delete element in map %s", kv.MapOfMapsKey.GetMapSection())
	}
	innerMapName, ok := pl.MapIDMapName[innerMapID]
	if !ok {
		return errors.Wrapf(errors.New(kv.MapSectionToClone), "unknown inner map ID %d", innerMapID)
	}
	innerMap, ok := pl.collection.Maps[innerMapName]
	if !ok {
		return errors.Wrapf(errors.New(kv.MapSectionToClone), "unknown inner map name %s", innerMapName)
	}
	if err := innerMap.Close(); err != nil {
		return errors.Wrapf(err, "couldn't close inner map for type %s", reflect.TypeOf(kv.MapOfMapsKey))
	}
	delete(pl.collection.Maps, innerMapName)
	delete(pl.MapIDMapName, innerMapID)
	return nil
}
func ( pl * ProfileLoader ) DeleteMapOfMapsKeyValue ( kv * keyvalue . MapOfMapsKeyValue ) error { byteOrder := utils . GetHostByteOrder ( ) mapOfMaps , ok := pl . collection . Maps [ kv . MapOfMapsKey . GetMapSection ( ) ] if ! ok { return errors . Wrap ( errors . New ( kv . MapOfMapsKey . GetMapSection ( ) ) , " " ) } keyPtr , err := kv . MapOfMapsKey . GetKey ( byteOrder ) if err != nil { return errors . Wrapf ( err , " " , reflect . TypeOf ( kv . MapOfMapsKey ) ) } innerMapIDB , err := mapOfMaps . GetBytes ( keyPtr ) if err != nil { return errors . Wrapf ( err , " " , reflect . TypeOf ( kv . MapOfMapsKey ) ) } innerMapID := byteOrder . Uint32 ( innerMapIDB ) if err := mapOfMaps . Delete ( keyPtr ) ; err != nil { return errors . Wrapf ( err , " " , kv . MapOfMapsKey . GetMapSection ( ) ) } innerMapName , ok := pl . MapIDMapName [ innerMapID ] if ! ok { return errors . Wrapf ( errors . New ( kv . MapSectionToClone ) , " " , innerMapID ) } innerMap , ok := pl . collection . Maps [ innerMapName ] if ! ok { return errors . Wrapf ( errors . New ( kv . MapSectionToClone ) , " " , innerMapName ) } if err := innerMap . Close ( ) ; err != nil { return errors . Wrapf ( err , " " , reflect . TypeOf ( kv . MapOfMapsKey ) ) } delete ( pl . collection . Maps , innerMapName ) delete ( pl . MapIDMapName , innerMapID ) return nil }
Deletes a map-of-maps key value in the kernel
Deletes a map - of - maps key value in the kernel
// Select map of maps // Generate inner map Key unsafe pointer // Fetch map id // Delete inner map entry in the map of maps // Select inner map name // TODO: this should be improved by querying the kernel with a BPF _ObjGetInfoByFD call // -> won't work for pinned map after an agent unexpected shut down and restart // Close inner map // Remove inner map from collection // Remove inner map from mapping ID <-> name