feat: calculate piece range and store the actual piece reader #906
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.
Description
This pull request introduces several changes to the
dragonfly-client-storage
and related modules to enhance the reading and caching mechanisms, as well as to improve the upload functionality. The most important changes include adding dual read functionality, refactoring existing read methods to use buffered readers, and updating the cache logic.Enhancements to Reading and Caching Mechanisms:
dragonfly-client-storage/src/content.rs
: AddedBufReader
to improve reading performance and introduced a new methodread_piece_with_dual_read
to support dual read functionality. [1] [2] [3]dragonfly-client/src/proxy/cache.rs
: Added methods to calculate piece ranges and updated the cache logic to handle HTTP range requests. [1] [2] [3]Improvements to Upload Functionality:
dragonfly-client-storage/src/lib.rs
: Addedupload_piece_with_dual_read
method to support dual read during upload operations.Refactoring and Code Simplification:
dragonfly-client/src/proxy/mod.rs
: Refactored the proxy logic to utilize the new dual read functionality and updated the cache handling logic. [1] [2] [3] [4]Miscellaneous Updates:
dragonfly-client/src/resource/persistent_cache_task.rs
: Renamed methods to remove the term "peer" and updated related log messages for clarity. [1] [2] [3] [4] [5] [6]Related Issue
Motivation and Context
Screenshots (if appropriate)