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

codegen: codegen generic event and response interfaces + usability improvements for helpers.pb.go #129

Merged
merged 4 commits into from
Jun 10, 2022

Conversation

willfindlay
Copy link
Contributor

@willfindlay willfindlay commented Jun 7, 2022

Slight refactors to make the codegen API more usable, especially around helpers.pb.go. In particular, we remove all the blank interfaces and replace them with sane types that enable compile-time type checking.

Please see individual commit messages.

@willfindlay willfindlay requested a review from a team as a code owner June 7, 2022 15:26
Copy link
Contributor

@michi-covalent michi-covalent left a comment

Choose a reason for hiding this comment

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

🚢

@jrfastab
Copy link
Contributor

jrfastab commented Jun 9, 2022

@willfindlay needs a rebase thanks!

This enables us to place codegen in different places, including the base directory where
gRPC codegen goes. In turn this allows us to extend the base API package with additional
types.

Signed-off-by: William Findlay <[email protected]>
This file contains two interfaces that make it easier to work with Tetragon API types,
namely Event messages and GetEventsResponse oneofs.

Signed-off-by: William Findlay <[email protected]>
Use the new Event interface generated in previous commits in the eventchecker. This
enables compile-time typechecking in methods that use the Event interface.

Signed-off-by: William Findlay <[email protected]>
@willfindlay willfindlay force-pushed the pr/willfindlay/codegen-type-helpers branch from e813de1 to 3b48d64 Compare June 9, 2022 16:13
@willfindlay
Copy link
Contributor Author

Bad rebase, fixing now.

This commit improves the helpers API to make naming more consistent and refactors it to
use the new code generated event interfaces we introduced earlier in this series.

Signed-off-by: William Findlay <[email protected]>
@willfindlay willfindlay force-pushed the pr/willfindlay/codegen-type-helpers branch from 3b48d64 to d94f202 Compare June 9, 2022 16:29
@willfindlay
Copy link
Contributor Author

@jrfastab should be good to go

@@ -269,7 +269,7 @@ func CheckerFromResponse(response *tetragon.GetEventsResponse) (EventChecker, er
}

// Event is an empty interface used for events like ProcessExec, etc.
type Event interface{}
type Event tetragon.Event
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

@kkourt kkourt merged commit 402d16f into main Jun 10, 2022
@kkourt kkourt deleted the pr/willfindlay/codegen-type-helpers branch June 10, 2022 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants