Package download system #7
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The mirroring system needs to download lots of packages, so we need some sort of queueing system.
For performing the downloads, we can use Hyper, as we already import it for Axum anyways. The download queue will therefore run inside the asynchronous runtime.
The straightforward solution would be to use a channel. The download queue could contain thousands of packages at once for a busy server, and these downloads can take a while to complete. Therefore it might be better to back up the queueing system with the database. A simple table containing
(repo id, file path)tuples should suffice. Each download agent would take one row at a time (synchronised using a mutex probably), download the package, and place it in the parse queue. We could perhaps use aNotifyconstruct to wake up the agents, so they don't need to poll the database. Once awoken, the agents will keep pulling rows from the database until there are none before going back to sleep.The amount of concurrent downloads should be configurable using a simple config option that specifies how many download actors to spawn.