Add support for parsing Protobuf-formatted artifacts - #841
Conversation
besendorf
left a comment
There was a problem hiding this comment.
I found three blocking correctness and validation issues. The full test suite passes (175 passed, 1 skipped), but the repository mypy check fails on this branch.
|
Hi, The streaming methods are:
I also understand that you already produce protobuf files though. I would wait until a few other people have voiced an opinion. |
|
Hi @besendorf, I agree that it is indeed possible to use JSON or JSONL. Protobuf is slightly faster (less characters to write/read compared to JSON key-values), has a lower size (10x, however after compression the difference is negligible. but MVT only supports uncompressed AndroidQF parsing) Finally, Protobuf allows for a fixed standard/source of truth. You can use that in Kotlin/Python/Go and everyone will benefit (AndroidQF/MVT/Bugbane would all adhere to the same format) |
|
Any updates on this? :) |
|
@DonnchaC needs to decide whether we want to support this |
Why?
Because the current JSON format used by MVT/AndroidQF do not directly allow for stream-read/write.
This becomes a problem when such JSON files must be read/written on devices with limited RAM.
For example the Files module of AndroidQF, reads all the data in memory and then store it in the acquisition archive.
On real-world devices with a lot of files this can become a problem.
Bugbane currenly produce size-delimited Protobuf artifacts instead of JSON to reduce RAM footprint, since they allow for partial and sequential read/write operation out-of-the-box. (write a single entry without having the whole array loaded in memory)
This PR adds upstream support for Protobuf-formatted artifacts.
JSON files always get the priority. If a JSON file is found, it is read and parsed. If no JSON files are found, the Protobuf counterpart are searched and loaded instead.
Protobuf parsing uses the betterproto2 library that is already used for parsing Tombstone artifacts.
This PR also add tests for all the relevant Protobuf artifact parsing.
Happy to make fixes or modifications if needed :)