Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(map): Introduce GetMapsIDsByName #378

Merged
merged 1 commit into from
Sep 14, 2023

Conversation

geyslan
Copy link
Member

@geyslan geyslan commented Sep 14, 2023

commit 682f395 (HEAD -> feat/get-maps-by-name, origin/feat/get-maps-by-name)
Author: aymericdd aymeric.daurelle@datadoghq.com
Date: Tue Sep 12 16:28:43 2023 +0200

feat(map): Introduce GetMapsIDsByName

Allow a user to get a list of maps IDs filtered by map name.

Co-authored-by: Geyslan Gregório <geyslan@gmail.com>

Allow a user to get a list of maps IDs filtered by map name.

Co-authored-by: Geyslan Gregório <geyslan@gmail.com>
@geyslan geyslan added the feature New feature or request label Sep 14, 2023
@geyslan geyslan self-assigned this Sep 14, 2023
@geyslan geyslan mentioned this pull request Sep 14, 2023
Copy link
Contributor

@aymericDD aymericDD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👏 Thanks for this great work! 🤗

selftest/map-getmapsbyname/main.bpf.c Show resolved Hide resolved
selftest/map-getmapsbyname/main.go Show resolved Hide resolved
log.Fatalf("the %s map with %d id was not found: %v", BPFMapNameToFind, id, err)
}

if bpfMap.Type() == BPFMapTypeToFind &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is already really nice 👍 But do you think it's a good idea to identify map by flags?
IMO: In a real scenario, I will more based my search on flags rather types.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, flags can be more one field to check. We only need to implement it:

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will help a lot to have flags because I will need it for our project to identify the origin of maps 👍
I can take a look to implement this feature if it could help 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can take a look to implement this feature if it could help 😄

Awesome! ❤️

log.Fatalf("no %s maps with the same properties found", BPFMapNameToFind)
}
if len(similarMaps) > 1 {
// This is a conundrum for the user, as they cannot decide which map to use
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flags can be the solution for this conundrum?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would help.

@geyslan
Copy link
Member Author

geyslan commented Sep 14, 2023

LGTM 👏 Thanks for this great work! 🤗

Great. I'm going to merge so we'll be able to improve it by implementing MapFlags(), MapExtra() etc.

@geyslan geyslan merged commit e6e4387 into aquasecurity:main Sep 14, 2023
@geyslan
Copy link
Member Author

geyslan commented Sep 14, 2023

@aymericDD Thanks a million once again.

@aymericDD
Copy link
Contributor

Is it possible to release the library with this new feature? I want to use it for our project. Thanks 🙏

@geyslan
Copy link
Member Author

geyslan commented Sep 26, 2023

Let's cut it. 👍🏼

@geyslan
Copy link
Member Author

geyslan commented Sep 26, 2023

@aymericDD please update your project with https://github.com/aquasecurity/libbpfgo/releases/tag/v0.5.1-libbpf-1.2

@aymericDD
Copy link
Contributor

Thanks a lot for your reactivity 🙏

@geyslan geyslan deleted the feat/get-maps-by-name branch November 28, 2023 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants