Jiahao XU
e376b71cf4
Simplify extract_tar_based_stream_and_visit
...
Rm unused param `path` and the unnecessary
`fs::create_dir_all` since the tar will not be extracted to disk.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 17:05:35 +10:00
Jiahao XU
17fcac7e63
Refactor: Simplify untar
with new enum Op
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 17:03:39 +10:00
Jiahao XU
b2c34137cc
Mark extract_compressed_from_readable
& unzip
to be pub(super)
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 16:56:41 +10:00
Jiahao XU
f82890cba3
Rm download_and_extract_with_filter
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 16:42:32 +10:00
Jiahao XU
e68eea35fe
Mark type ManifestVisitor
as pub(super)
...
Since mod `cretesio` is the only one need to have access to it.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 16:40:51 +10:00
Jiahao XU
5bb5d12949
Optimize fetch_crate_cratesio
using ManifestVisitor
...
and `download_tar_based_and_visit`.
By using these two items, we avoid any I/O altogether.
Everything happens in memory, thus there will be no i/o related errors
or cost.
This commit does not regress anything because
`helpers::load_manifest_path` calls `Manifest::from_path_with_metadata`,
which read in the whole `Cargo.toml` file at once.
Thus this commit would not cause any OOM when the the original code
would not.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 16:37:53 +10:00
Jiahao XU
f3d3c488e3
Impl new type `ManifestVisitor
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 16:32:36 +10:00
Jiahao XU
44d43113f4
Forward impl AbstractFilesystem
for &Vfs
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 16:08:41 +10:00
Jiahao XU
3c30722a06
Impl new type Vfs
which impl AbstractFilesystem
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 01:57:34 +10:00
Jiahao XU
c6687edf48
Fix visbility of PathExt
: Mark it as pub
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 01:54:15 +10:00
Jiahao XU
cb2be5a882
Add new trait PathExt
& impl for Path
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 01:46:10 +10:00
Jiahao XU
0162f5f462
Add doc for TarEntriesVisitor
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 22:53:34 +10:00
Jiahao XU
0eb9424f17
Set vis of find_version
to pub(super)
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 22:47:47 +10:00
Jiahao XU
6c6055da69
Refactor mod drivers
: Extract out sub mods
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 22:43:45 +10:00
Jiahao XU
f8c8c66f57
Impl new fn helpers::download_tar_based_and_visit
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 20:38:11 +10:00
Jiahao XU
4892d8bf3a
Impl forward of &mut T
to T
for TarEntriesVisitor
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 20:35:02 +10:00
Jiahao XU
90a96cabc9
Rewrite untar
to take a visitor & simplify
...
signature of `download_and_extract_with_filter`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 20:31:46 +10:00
Jiahao XU
5a43ee2681
Simplify extract_compressed_from_readable
impl
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 20:16:41 +10:00
Jiahao XU
57b40d809e
Cleanup mod async_extracter
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 20:15:17 +10:00
Jiahao XU
7b52eaad5b
Rewrite AsyncExtracter
: Extract fmt logic as callback fn
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 20:15:17 +10:00
Jiahao XU
d1033758a7
Update doc of download_and_extract_with_filter
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 20:15:17 +10:00
Jiahao XU
b1b79921b2
Simplify download_and_extract_with_filter
: Take TarBasedFmt
...
instead of `PkgFmt`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 20:15:17 +10:00
Jiahao XU
cbd57a1bce
Refactor async_extracter
: Create multi extracters
...
dedicated to different tasks
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 20:15:17 +10:00
Jiahao XU
bd68613448
Refactor and add new enum PkgFmtDecomposed
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 20:15:17 +10:00
Félix Saparelli
c33f195d5f
Merge pull request #178 from NobodyXu/ci
2022-06-11 21:57:38 +12:00
Jiahao XU
5302240829
Refactor workflow rust: Extract test into script
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 18:21:57 +10:00
Félix Saparelli
bd4cc85386
Merge pull request #179 from NobodyXu/feature/improve-readable-rx
2022-06-11 20:11:33 +12:00
Félix Saparelli
50183a38c5
Merge pull request #171 from NobodyXu/fix/confirm
2022-06-11 20:11:20 +12:00
Jiahao XU
9bf1ce3000
Fix typo in step "Test (Unix)"
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 17:11:52 +10:00
Jiahao XU
dd24661091
Test installed bin in step "Test (Windows)"
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 17:02:53 +10:00
Jiahao XU
19656b6f45
Fix typo in step "Test"
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 17:02:31 +10:00
Jiahao XU
4b78d4eb4d
Fix step Test: Run cargo binstall --help
instead
...
of `cargo binstall --version` since `--version` does not print the
version of `cargo-binstall`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 16:52:51 +10:00
Jiahao XU
58f0d5f12d
Run bins after installation in step "Test"
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 16:43:11 +10:00
Jiahao XU
868f6c2759
Add more debug!
to untar
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 16:13:33 +10:00
Jiahao XU
4a882dc2cb
Use BufRead
inextract_compressed_from_readable
...
Use `BufRead` instead of `Read` to avoid copying of data and improve
efficiency.
`GzDecoder` and `XzDecoder` both have their `BufRead` counterpart
in mod `bufread` and their `read` counterpart merely wraps the input in
a `std::io::BufReader`.
`ZstdDecoder::new` also wraps it in a `BufReader` and pass it to
`ZstdDecoder::with_buffer`.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 15:44:16 +10:00
Jiahao XU
e753c9ec30
Impl BufRead
for ReadableRx
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 15:41:15 +10:00
Jiahao XU
ac22db5e79
Set log level to debug in step "Test"
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 14:37:14 +10:00
Jiahao XU
4c210fd2c3
Rm unused imports in mod helpers
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 12:59:41 +10:00
Jiahao XU
88c3f15b3f
Rename Confirmer
to UIThread
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 12:59:27 +10:00
Jiahao XU
9349fbabdc
Unwrap
in Confirmer
task if failed to read
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 12:59:27 +10:00
Jiahao XU
b2bf065a2b
Rm unused fn helpers::confirm::confirm
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 12:59:26 +10:00
Jiahao XU
47ed7ce27b
Use Confirmer
instead of confirm
in main.rs
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 12:59:26 +10:00
Jiahao XU
dd2fa2de33
Impl helpers::confirm::Confirmer
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 12:59:26 +10:00
Jiahao XU
c1809d41fa
Refactor: Extract confirm
into a new mod
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 12:59:22 +10:00
Félix Saparelli
f53680c497
Merge pull request #174 from NobodyXu/fix/find_crate_cratesio
2022-06-11 14:54:50 +12:00
Jiahao XU
4297b13ed9
Fix testing on Windows
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 18:20:59 +10:00
Jiahao XU
fbcfe369da
Rm cbindgen from bins
in step "Test"
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 18:16:28 +10:00
Jiahao XU
cfa6090e6e
Rm non-existent crate in step "Test"
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 17:32:38 +10:00
Jiahao XU
ea71cede42
Fix if
cond for step "Test"
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 17:28:23 +10:00
Jiahao XU
e312a22ba2
set -euxo pipefail
in step "Test"
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 17:19:21 +10:00