-
Notifications
You must be signed in to change notification settings - Fork 278
WIP: Split/regroup client components #1326
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
WIP: Split/regroup client components #1326
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 <[email protected]>
Make the helper methods used by the refactored Updater part of the class. Mark them as "staticmethod". Signed-off-by: Teodora Sechkova <[email protected]>
Move the code that implements the update of the metadata files to a separate class called MetadataUpdater. Signed-off-by: Teodora Sechkova <[email protected]>
Move target files update code to a separate class. Signed-off-by: Teodora Sechkova <[email protected]>
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 <[email protected]>
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 <[email protected]>
Make fetcher a member of Mirrors class. Move the instantiation of the default fetcher object to the Mirrors constructor. Signed-off-by: Teodora Sechkova <[email protected]>
Move the functionality from the download module inside Mirrors class. Signed-off-by: Teodora Sechkova <[email protected]>
Apply manually black and isort to fetcher.py and request_fetcher.py Signed-off-by: Teodora Sechkova <[email protected]>
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 APIMetadataUpdater
TargetsUpdater
Regrouping of client-related modules:
client_rework
directoryblack
andisort
on the modules with the old code styledownload.py
is deleted and its functionality is merged withmirrors.py
which is nowmirrors_download.p
yMirrors
classPlease verify and check that the pull request fulfills the following
requirements: