Commit graph

18 commits

Author SHA1 Message Date
Félix Saparelli
adef01f3dd
Find best download source out of alternatives (format extension) (#236) 2022-07-24 14:32:23 +12:00
Jiahao XU
305a4e4c30
Improve err msg in MultiFetcher::first_available
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 13:07:20 +10:00
Jiahao XU
dc8d8ccd88
Optimize MultiFetcher: Start checking ASAP
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 13:06:34 +10:00
Jiahao XU
fa63dbe5cf
Refactor: Rm global var helpers::CLIENT
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-10 18:07:07 +10:00
Jiahao XU
c9b0d45a24
Use download_and_extract in fetchers
to improve efficiency by avoiding disk io (except for `PkgFmt::Zip`
and `PkgFmt::Bin`) and run the compresser in parallel to the downloader.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 14:46:00 +10:00
Jiahao XU
d9bcca8b78
Impl AutoAbortJoinHandle::new & make its field private
plus change all its users to use its new APIs.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:53:49 +10:00
Jiahao XU
12931fc024
Refactor: Mv AutoAbortJoinHandle into helpers
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:44:20 +10:00
Félix Saparelli
aad708a035
Slightly more ergo clone by ordering 2022-06-08 16:43:18 +12:00
Jiahao XU
6f7c8fa8ab
Merge branch 'main' into feature/bin-multi-targets 2022-06-07 16:38:14 +10:00
Jiahao XU
3f2e03893a
Add Fetcher::target to trait Fetcher
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 16:35:47 +10:00
Jiahao XU
3d6679fd7d
Refactor MultiFetcher.first_available
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 15:35:21 +10:00
Jiahao XU
c393270899
Run fetchers in parallel in MultiFetcher.first_available
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 15:29:09 +10:00
Jiahao XU
d373ad5145
Require Send and Sync for trait Fetcher
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 15:28:48 +10:00
Jiahao XU
31b7439a69
Mod trait Fetcher::new to return Arc<Self>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 15:16:10 +10:00
Félix Saparelli
ac74da4a27
Clippy suggestions 2022-06-01 01:11:26 +12:00
Félix Saparelli
c0eaffb05d
Refactor for rich errors, split user abort and genuine error 2022-06-01 00:29:14 +12:00
Félix Saparelli
1757dc5344
Make fetcher creating infallible (#118)
Fixes #109
2022-04-29 09:24:46 +12:00
Félix Saparelli
370ae05620
QuickInstall support (#94)
See this issue: https://github.com/alsuren/cargo-quickinstall/issues/27

Quick Install is a hosted repo of built crates, essentially. The approach I've taken here is
a list of strategies:

1. First, we check the crate meta or default and build the URL to the repo. Once we have
   that, we perform a `HEAD` request to the URL to see if it's available.
2. If it's not, we build the URL to the quickinstall repo, and perform a `HEAD` to there.

As soon as we've got a hit, we use that. I've built it so it's extensible with more strategies.
This could be useful for #4.

This also adds a prompt before downloading from third-party sources, and logs a short
name for a source, which is easier to glance than a full URL, and includes a quick refactor
of the install/link machinery.
2022-02-16 14:49:07 +13:00