New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: chunk files only once when making payment for their storage #501
refactor: chunk files only once when making payment for their storage #501
Conversation
let client = self.client.clone(); | ||
let chunk_addr = *chunk.address(); | ||
let payment = payment_proofs.get(chunk_addr.name()).cloned(); | ||
// TODO: re-enable requirement to always provide payment proof |
Check notice
Code scanning / devskim
A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note
f56da96
to
c58db73
Compare
value: Bytes::from(file), | ||
}), | ||
(_, Err(err)) => { | ||
// FIXME: this error won't be seen/reported, thus assumed all chunks were read and stored. |
Check notice
Code scanning / devskim
A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note
client: &Client, | ||
root_dir: &Path, | ||
files_path: &Path, | ||
) -> Result<PaymentProofsMap> { | ||
pay: bool, // TODO: to be removed; temporarily payment is optional |
Check notice
Code scanning / devskim
A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note
fcb4001
to
b46fcdc
Compare
b46fcdc
to
722ac36
Compare
Resolves #340 .
Description
Summary generated by Reviewpad on 10 Jul 23 17:45 UTC
This pull request refactors the code related to making payments for storage when chunking files. It includes changes to the
files.rs
andwallet.rs
files.In the
files.rs
file, theupload_files
function has been modified to chunk and store files in a more efficient way. Instead of chunking files and making payments for each chunk individually, now the files are chunked only once and stored using thechunk_and_pay_for_storage
function from thewallet.rs
file. Theupload_file
function has been renamed toupload_chunks
to reflect this change.The
upload_files
function now takes care of storing the chunks and generating the proofs for payment. It also creates a directory to store the uploaded files and saves information about the uploaded files in a file for future reference.The
chunk_and_pay_for_storage
function in thewallet.rs
file has been modified to accommodate the changes in thefiles.rs
file. It now takes an additional parameterpay
to indicate whether payment should be made for storage. It chunks the files, stores the chunks, and generates the payment proofs ifpay
is true.Overall, these changes improve the efficiency of chunking and storing files by reducing the number of times chunks are created and payments are made.