WIP: Split/regroup client components#1326
WIP: Split/regroup client components#1326sechkova wants to merge 9 commits intotheupdateframework:experimental-clientfrom
Conversation
The modules performing network download are used only by the client side of TUF. Move them inside the client directory for the refactored client. Move the _mirror_*download functions from Updater to mirrors.py. Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
Make the helper methods used by the refactored Updater part of the class. Mark them as "staticmethod". Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
Move the code that implements the update of the metadata files to a separate class called MetadataUpdater. Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
Move target files update code to a separate class. Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
The two functions safe/unsafe_download differ only by setting a single boolean flag. Remove them and call directly _download_file instead. Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
Wrap the functionality from the mirrors.py module inside a Mirrors class. Apply black and isort over the old-style mirrors code. Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
Make fetcher a member of Mirrors class. Move the instantiation of the default fetcher object to the Mirrors constructor. Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
Move the functionality from the download module inside Mirrors class. Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
Apply manually black and isort to fetcher.py and request_fetcher.py Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
|
Personally I think this validates the idea of separating (at least some of these) things:
As a general comment: I think splitting the PR might be useful: Mirrors, MetadataUpdater and TargetUpdater are all kind of separate ideas that we should be able to discuss separately. Also I think there's a lot in the code we could improve in each case -- if we start doing it in this PR this becomes a very long discussion again and I think we should rather aim for smaller faster merges. I get that the changes can be a bit tricky to work on at the same time... but it might be worth it I've got more notes written about this: I can write them down once you decide how you want to proceed (don't want to fill this PR with details unless you want to handle them here). |
Agree that we should think about the naming.
Agree, this change made was good.
I am also thinking about that.
I was going to write the same. The creation of the |
|
I opened a separate PR for mirrors/download redesign (#1331) and I will follow up with another one related to splitting the
I keep the old duplicated code because we still plan to merge the
I agree but can we do that at the end when we have defined what is what? |
|
Sounds great thank you.
Maybe -- The balancing act is this: I don't want us to maintain two client implementations at the same time if we can avoid it, yet I don't want to delay merging this to develop any longer than necessary. I'd say let's keep doing what you're doing for now now but keep the option open and re-evaluate after a few weeks: maybe at some point it becomes clear that the refactored client is going to be clearly better and the choice is then easy.
Sure! |
|
Thanks for the feedback. The same commits from this PR are split in two separate PRs:
Let's continue the separate discussions there. I am closing this one. |
Addresses: #1307, #1308
Description of the changes being introduced by the pull request:
Updater is split in three classes (names are tentative):
Updater: public APIMetadataUpdaterTargetsUpdaterRegrouping of client-related modules:
client_reworkdirectoryblackandisorton the modules with the old code styledownload.pyis deleted and its functionality is merged withmirrors.pywhich is nowmirrors_download.pyMirrorsclassPlease verify and check that the pull request fulfills the following
requirements: