-
Notifications
You must be signed in to change notification settings - Fork 278
experimental client: download functions review #1339
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
Comments
this is very much related to #1318 -- the tricky file object handling is in these two functions and in the callers |
I think this is a good place to document the discussion from yesterday (@sechkova can fix mistakes): We've come to the conclusion that separating the download/mirror functionality as I suggested does not work better than the "old way". There's two things interacting here: the need to download a file from possibly multiple mirrors and the validation and verififcation of that file -- we don't know if we need to download from other mirrors until we've fully validated/verified the file from the first mirror. This is especially an issue for metadata which needs to not just be internally validated but also verified by other current metadata... This means that there are really two choices:
The second option just seems better: the updater download loops are monsters but it seems taking this specific for-loop out is not helpful. experimental-client sort of does the second option but with iterators that I think are not an improvement -- we've agreed to take a step back to something even more similar to current updater (no iterators, just a list of mirror-urls : code already known to work). To make the very long updater loops more readable by other means I'm experimenting with #1313 (taking the metadata validity enforcing elsewhere). |
If it makes the code simpler, we should just do away with mirrors. No one really uses them anymore. |
ha! I just added an edit mentioning that :) Unfortunately pip does need multiple hosts for targets. It's not quite the concept of mirrors (the hosts don't have the same targets) but currently the mirrors configuration can be used for it with some wrestling |
Still, now that you said it: if we slightly modified how the mirrors work, they would be much easier to work with:
This change would make the whole mirroring quite a lot simpler. Obviously it would mean a malicious mirror could now deny all service to a client (but as you said, mirrors aren't really used as actual mirrors so this is already the case -- pypi.org will be able to deny service to pip :) ) |
Decided to take a step back, implement the mirrors download in a clean but very repetitive way inside Updater and add some additional clean up of temporary objects: #1352. |
I don't think this is a problem TUF should solve at the risk of added complexity, especially if it's designed for only one use case in mind. Could pip solve that problem on its own? |
I do agree with the beginning of that sentence. Yet, not taking into account real world use cases creates designs that are great for research projects. I have not other data but would be surprised if multiple download domains is going to be unique to pip.
Well, TUF is designed to resolve a target name to a URL... If this design is used then TUF must be able to choose the host(s) is should use. One alternative that I can see is that we do not use TUF for anything except metadata: in the current implementation that would mean after Another is that every download call ( |
By the way, in case I've not been clear about this: this is not an issue in how pip is designed, it's an issue with how pypi hosts its files: One host (pypi.org) serves metadata and targets. These targets contain URLs that pip parses to find more host-URLs: these hosts only serve target files -- currently the only host is pythonhosted.org but it could be anything. Apart from parsing target files to find more hosts, this sounds completely reasonable: assuming that metadata and targets are on the same host (or that targets are all on one host) could be a mistake for TUF. |
Resolved with #1373 and the remove of mirrors support. |
Current state of _mirror_target_download() and _mirror_meta_download() in experimental client is a bit bad:
I would suggest we revert to a known working design if possible (
_mirror_target_download()
could just be almost 1:1 the current clients_get_target_file()
function but the metadata verification needs something else).I'll try to come up with something...
The text was updated successfully, but these errors were encountered: