Skip to content

Conversation

gaius-qi
Copy link
Member

Description

This pull request introduces several updates to the Dragonfly client, focusing on enhancing task handling, improving tracing, and standardizing headers. Key changes include adding a local_only flag to task status queries, extending task metadata handling for local storage, and renaming constants for clarity. Below is a breakdown of the most important changes:

Enhancements to Task Handling:

  • Added a local_only flag to the stat_task methods in both DfdaemonDownloadServerHandler and DfdaemonUploadServerHandler, allowing task status to be queried exclusively from local storage. This includes updates to span recording and method signatures. (dragonfly-client/src/grpc/dfdaemon_download.rs: [1] [2] [3]; dragonfly-client/src/grpc/dfdaemon_upload.rs: [4] [5] [6]
  • Enhanced the stat method in the Task struct to support retrieving task metadata and pieces from local storage when local_only is true. This includes filtering unfinished pieces and constructing a detailed CommonTask response. (dragonfly-client/src/resource/task.rs: dragonfly-client/src/resource/task.rsL1838-R1908)

Improvements to Tracing and Metrics:

  • Updated tracing spans to include the local_only flag in both download and upload server handlers for better observability. (dragonfly-client/src/grpc/dfdaemon_download.rs: [1] [2]; dragonfly-client/src/grpc/dfdaemon_upload.rs: [3] [4]

Header Standardization:

  • Renamed several header constants for consistency by appending _HEADER to their names (e.g., DRAGONFLY_PIECE_LENGTH to DRAGONFLY_PIECE_LENGTH_HEADER). Updated all references accordingly, including tests and utility functions. (dragonfly-client/src/proxy/header.rs: [1] [2] [3] [4]
  • Introduced a new header constant, DRAGONFLY_TASK_DOWNLOAD_FINISHED_HEADER, to indicate when a task download is complete. Added logic to include this header in responses. (dragonfly-client/src/proxy/header.rs: [1]; dragonfly-client/src/proxy/mod.rs: [2]

Codebase Enhancements:

  • Added a get_all method to the Piece struct for retrieving all pieces of a task from local storage. (dragonfly-client/src/resource/piece.rs: dragonfly-client/src/resource/piece.rsR147-R151)
  • Included additional imports (e.g., HashMap) and minor refactoring in the Task struct to support new functionality. (dragonfly-client/src/resource/task.rs: [1] [2] [3]

Dependency Update:

  • Updated the dragonfly-api dependency version from 2.1.47 to 2.1.49 in Cargo.toml. (Cargo.toml: Cargo.tomlL32-R32)

Related Issue

Motivation and Context

Screenshots (if appropriate)

…k stat

Signed-off-by: Gaius <gaius.qi@gmail.com>
@gaius-qi gaius-qi added this to the v2.4.0 milestone Jul 23, 2025
@gaius-qi gaius-qi self-assigned this Jul 23, 2025
@gaius-qi gaius-qi requested a review from a team as a code owner July 23, 2025 09:40
@gaius-qi gaius-qi added the enhancement New feature or request label Jul 23, 2025
@github-actions github-actions bot requested review from chlins and CormickKneey July 23, 2025 09:40
Copy link
Contributor

@LunaWhispers LunaWhispers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@LunaWhispers LunaWhispers enabled auto-merge (squash) July 23, 2025 09:41
Copy link
Member

@chlins chlins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link

codecov bot commented Jul 23, 2025

Codecov Report

Attention: Patch coverage is 21.81818% with 43 lines in your changes missing coverage. Please review.

Project coverage is 47.26%. Comparing base (7190529) to head (b72ee40).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
dragonfly-client/src/resource/task.rs 0.00% 24 Missing ⚠️
dragonfly-client/src/proxy/mod.rs 0.00% 6 Missing ⚠️
dragonfly-client/src/grpc/dfdaemon_download.rs 0.00% 5 Missing ⚠️
dragonfly-client/src/grpc/dfdaemon_upload.rs 0.00% 5 Missing ⚠️
dragonfly-client/src/resource/piece.rs 0.00% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1250      +/-   ##
==========================================
- Coverage   47.42%   47.26%   -0.16%     
==========================================
  Files          60       60              
  Lines       14536    14583      +47     
==========================================
- Hits         6893     6892       -1     
- Misses       7643     7691      +48     
Files with missing lines Coverage Δ
dragonfly-client/src/proxy/header.rs 92.07% <100.00%> (+0.21%) ⬆️
dragonfly-client/src/resource/piece.rs 63.69% <0.00%> (-0.58%) ⬇️
dragonfly-client/src/grpc/dfdaemon_download.rs 0.00% <0.00%> (ø)
dragonfly-client/src/grpc/dfdaemon_upload.rs 0.00% <0.00%> (ø)
dragonfly-client/src/proxy/mod.rs 0.00% <0.00%> (ø)
dragonfly-client/src/resource/task.rs 8.38% <0.00%> (-0.44%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LunaWhispers LunaWhispers merged commit 10c7311 into main Jul 23, 2025
9 checks passed
@LunaWhispers LunaWhispers deleted the feature/response branch July 23, 2025 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants