feat: use progress bars on files upload
#801
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
7d95d86 refactor: pay_for_chunks returns cost and new balance
Rather than the client printing out information relating to the cost of the chunks and the resulting
new balance, the information is returned to the caller, who can then print it out.
The error handling for storing the wallet is also changed to propagate the error rather than
suppressing it by printing output.
ce3c585 refactor: use one files api and clarify variable names
The
file_api
was being created multiple times when it didn't seem to need to be. It is easier topass around the
file_api
that you create once, rather than the client and the wallet directorypath.
I also renamed
root_dir
towallet_dir_path
because there didn't seem to be any need for it tonot be more specific as to what it actually refers to.
6665ff2 feat: use progress bars on
files upload
Change the user interface for the
files upload
command to use progress bars to indicate the statusof the following operations:
It uses a simple approach, which is to create a new
ProgressBar
for each of the operations, ratherthan attempt to use a
MultiBar
or re-use the same progress bar. In this simple approach, thefinish_and_clear
function removes the bar from stderr, then a new bar is created for the nextoperation.
The
println!
output from the client was removed in favour of returning that information back tothe caller.
There is much less text in the output of the command now, but it hopefully communicates everything
that's important.
Description
Summary generated by Reviewpad on 05 Oct 23 00:05 UTC
This pull request includes the following changes:
NanoTokens
struct has been imported from thesn_transfers
module.pay_for_chunks
method now returns the cost and new balance of the local wallet.pay_for_chunks
method has been improved.The "Justfile" script has been modified to add a new task called "run-local-network". This task kills the processes "safenode" and "faucet", removes the directory "~/.local/share/safe", and then builds the testnet with local discovery using "cargo" with an interval of 1000.
In the "Cargo.toml" file, the following changes have been made:
indicatif
with version0.17.5
and features["tokio"]
.libp2p
to version0.52
and added features["identify", "kad"]
.reqwest
to version0.11.18
with default features disabled and added feature["rustls"]
.In the
wallet.rs
file, there are several changes:root_dir
parameter has been replaced withwallet_dir_path
.send
,receive
, andget_faucet
functions now include thewallet_dir_path
parameter.WalletCmds::Pay
variant has been modified to include apath
parameter andbatch_size
field.chunk_path
function now takes afile_api
parameter instead ofclient
androot_dir
.file_api
has been moved outside theWalletCmds::Pay
variant.The "indicatif" dependency has been added to the
Cargo.lock
file.In the
local_store.rs
file, theprintln!("Transfers applied locally");
statement has been removed from theupdate_local_wallet
method of theLocalWallet
struct.The
wallet.rs
file has the following changes:Instant
has been removed.num_of_payments
has been removed.now
and its usage in time tracking have been removed.Please let me know if you need more information on any specific lines of code.