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

Only parse as much of files as needed #6

Open
cmeister2 opened this issue Jul 22, 2022 · 1 comment
Open

Only parse as much of files as needed #6

cmeister2 opened this issue Jul 22, 2022 · 1 comment

Comments

@cmeister2
Copy link
Collaborator

In fez I added an RpmPkgReader class (https://github.com/cmeister2/fez/blob/main/src/rpm/package.rs#L233) which allowed for "on-demand" reading of RPM files - if you only wanted to read the metadata, you could, without having to download the whole package first.

I tried for a while to come up with a sensible design for this, with several issues:

  • the mutability of the Read object needs to be taken into account
  • working out what data has been read and what data has not been read, and caching the data that has been read, made for a confusing time. I didn't find a wonderfully smooth solution here.

It'd be nice if it didn't have to be a separate class, if possible.

@dralley
Copy link
Collaborator

dralley commented Jul 26, 2022

RPM headers usually aren't that big, so I'm thinking a convenient use case might be to just read the header into a &[u8] and parse it from there directly, which solves both problems - no need for caching because it's already in memory, and the data is immutable.

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

No branches or pull requests

2 participants