-
Notifications
You must be signed in to change notification settings - Fork 75
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
ffi: Add support for serializing a KeyValuePairLogEvent
as a nlohmann::json
object.
#512
Conversation
KeyValuePairLogEvent
to nlohmann::json
object.KeyValuePairLogEvent
to nlohmann::json
object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good to me -- just a few minor changes that could help make this code easier to understand.
Per previous discussions this PR is focused on finishing a functional implementation, so discussion about performance is left out of this review.
Co-authored-by: Devin Gibson <[email protected]>
Co-authored-by: kirkrodrigues <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some renaming suggestions to be more explicit and avoid confusion between the schema tree node and corresponding JSON object. We can discuss it if you think it's too explicit, but I don't think the long names make the code significantly less readable.
Co-authored-by: kirkrodrigues <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the PR title, how about:
ffi: Add support for serializing a KeyValuePairLogEvent
as a nlohmann::json
object.
KeyValuePairLogEvent
to nlohmann::json
object.KeyValuePairLogEvent
as a nlohmann::json
object.
…ann::json` object. (y-scope#512) Co-authored-by: Devin Gibson <[email protected]> Co-authored-by: kirkrodrigues <[email protected]>
…ann::json` object. (y-scope#512) Co-authored-by: Devin Gibson <[email protected]> Co-authored-by: kirkrodrigues <[email protected]>
Description
Note: this PR should not be merged before #507 and #511
This PR implements a method in
KeyValuePairLogEvent
to serialize it into anlohamnn::json
object.KeyValuePairLogEvent
, as the output ofDeserializer
in key-value pair IR format, will be processed by the ffi libraries. Each ffi library has to turn this C++ object into some dynamic data structure in their language. Ideally,KeyValuePairLogEvent
can be serialized intomsgpack
byte sequence. However, there are two problems we need to solve:msgpack
library to construct an in-memory map and then serialize it into bytes.Therefore, we decided to serialize
KeyValuePairLogEvent
intonlohmann::json
object instead for now.nlohmann::json
provides a better support to construct an in-memory map, and also provides methods to serialize the result into eithermsgpack
byte sequence or JSON string.With this PR, we should have all the necessary pieces to integrate serialization/deserialization features of the key-value pair IR format into our ffi libraries.
Validation performed
KeyValuePairLogEvent
can be successfully serialized intonlohmann::json
objects, and be identical with the objects before serialization.