client/updater design: parallel downloads

Offen
#1,158 1 Kommentar 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
25/100
Issue-Typ
Feature
Klarheit
Muss geklärt werden
Aktivitätsstatus
Veraltet
Tech-Stack
python

Rechercherichtung

Lesen Sie zunächst die vorhandenen Einstiegspunkte Updater.refresh(), Updater.get_valid_targetinfos(list) und Updater.download_targets(list), und prüfen Sie anschließend den im Issue beschriebenen Kontext für parallele Downloads in pip. Legen Sie einen konkreten API- oder Nebenläufigkeitsumfang fest; als abgeschlossen gilt die Aufgabe, wenn targets und bin-Metadaten parallel heruntergeladen werden können, ohne den gemeinsam genutzten Updater-Zustand unsicher zu machen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

enhancement ngclient

Updater should in some way support parallel downloads.

This came up because I found an obscure corner in pip that does index file downloads in parallel in pip (pip list --outdated): if I plug my TUF-support in there, TUF Updater gets called from multiple threads and very bad things happen.

Some notes on this:

  • for the pip use case, letting pip handle the actual downloads would remove 50% of the need for this -- but bin metadata downloads would still be sequential (and Updater.refresh() would still be thread-unsafe)
  • Still, parallel downloads (for both targets and bin metadata) is probably a wanted feature in other user-facing apps as well: it is faster and is something package managers already often do
  • this feature does not mean that TUF API absolutely needs to be threadsafe: many use cases would be covered by small API change: Updater.get_valid_targetinfos(list) and Updater.download_targets(list) could still be a single-threaded API but they could be implemented in a way that uses multiple threads and multiple connections to the server. I have no idea how easy this would be though.
  • The nicest solution might be a low-level Sans-IO style API (a state machine with events) or at least something that is asynchronous to the users. This API is then wrapped by a simple I/O layer that could look much like it now does. This would mean a large change.
Vorherrschende Sprache
Python
Sterne
1.7k
Forks
304
Ø Merge
1 T. 2 Std.
Gemergte PRs (30 T.)
17

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus theupdateframework/python-tuf

Alle Issues in theupdateframework/python-tuf

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.