-
-
Notifications
You must be signed in to change notification settings - Fork 23
add protobuf parsing for binary #48
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
Conversation
Hello! Could you expand a bit on what these are used for? Thank you 🙏 Don't we also need functions to download this data? Where does it come from? We'll also need documentation and tests for any new functions. |
These are functions to parse protobuf messages from the binary format. These are used in the case that a request is not made so a response is not available. For example reading from a message cache.
It is my understanding that hexpm-rust does not handle downloading data and making http requests, so procuring the data is the responsibility of library consumers.
In the case of gleam-lang/gleam#2162 the body of successful response is cached. Parsing only signed messages should prevent any shenanigans with the protobuf apis. |
I believe I have covered raised issues, and am ready for any new ones. |
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.
It is my understanding that hexpm-rust does not handle downloading data and making http requests, so procuring the data is the responsibility of library consumers.
No, but we do expose functions for constructing the HTTP requests, as you can see from the functions for working with the Hex API.
I think the plan is to use these with the protobuf index files that can be downloaded from the Hex repo (sounds great!), so let's add a function for constructing the requests to download these files. Matching functions that decode the response would be fab too, checking the HTTP status, and parsing the body.
Currently
Ditto: I think I may have misunderstood. Could you provide some clarification? Do you mean check 200 then decompress? I.E. |
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.
Apologies, I got confused with my previous comments, I thought that the existing functions used the API and not the registry. This looks great!
All good I could have been clearer. Thank you for the help particularly with discarding #47, that was a mess. |
split
parse_repository_v2_versions
off ofget_repository_versions_response
, and splitparse_repository_v2_package
off ofget_package_response
The new functions do the same protobuf parsing as the
..._response
functions but start from binary rather than a response allowing protobuf messages to be stored and parsed at different times.required by gleam-lang/gleam#2162