feat: remove unnecessary get_piece #869
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.
Description
This pull request introduces several changes to the
dragonfly-client-storage
anddragonfly-client
projects. The primary focus is on improving the codebase by making function parameters more consistent and adding new methods to check the existence of tasks, persistent cache tasks, and pieces. Additionally, error handling and logging are enhanced in some parts of the code.Changes related to function parameters:
dragonfly-client-storage/src/content.rs
: Updatedhard_link_or_copy_task
andhard_link_or_copy_persistent_cache_task
methods to take task parameters by reference instead of by value. [1] [2]dragonfly-client-storage/src/lib.rs
: Updatedhard_link_or_copy_task
andhard_link_or_copy_persistent_cache_task
methods to take task parameters by reference. [1] [2]dragonfly-client/src/grpc/dfdaemon_download.rs
: Updated multiple methods inDfdaemonDownloadServerHandler
to take task parameters by reference. [1] [2] [3] [4]dragonfly-client/src/grpc/dfdaemon_upload.rs
: Updated multiple methods inDfdaemonUploadServerHandler
to take task parameters by reference. [1] [2] [3] [4]dragonfly-client/src/resource/persistent_cache_task.rs
: Updated multiple methods inPersistentCacheTask
to take task parameters by reference. [1] [2] [3] [4] [5] [6] [7] [8]New methods for checking existence:
dragonfly-client-storage/src/lib.rs
: Addedis_task_exists
,is_persistent_cache_task_exists
, andis_piece_exists
methods inStorage
to check if tasks, persistent cache tasks, and pieces exist, respectively. [1] [2] [3]dragonfly-client-storage/src/metadata.rs
: Added corresponding methods inMetadata
to support the existence checks. [1] [2] [3]dragonfly-client-storage/src/storage_engine/mod.rs
: Addedis_exist
method to theOperations
trait to check if an object exists by key.dragonfly-client-storage/src/storage_engine/rocksdb.rs
: Implemented theis_exist
method forRocksdbStorageEngine
.Error handling improvements:
dragonfly-client/src/resource/piece.rs
: Enhanced error handling and logging in thedownload_piece_from_remote_peer_finished
anddownload_piece_from_source_finished
methods. [1] [2]Related Issue
Motivation and Context
Screenshots (if appropriate)