Skip to content
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

Overhaul core Tracker: review whitelist functionality #1269

Conversation

josecelano
Copy link
Member

@josecelano josecelano commented Feb 14, 2025

Overhaul core Tracker: review whitelist functionality.

Sub-tasks

  • Introduce submodules for handlers in UDP: servers::udp::handlers::{announce, scrape}.
  • Create the missing services (app layer) in the UDP tracker. There is no intermediary level between handlers and the core tracker. It will moved to its own package udp-tracker-core later.
  • Move the service services::announce::invoke() in the HTTP tracker to the http-tracker-core package.
  • Move the service services::announce::invoke() in the UDP tracker to the udp-tracker-core package.
  • Move logic from the handler (in the framework level - delivery layer) to the application service in the http-tracker-core package.
    • For the announce request
    • For the scrape request
  • Move logic from the handler (controller level - delivery layer) to the application service in the udp-tracker-core package.
    • For the announce request
    • For the scrape request
  • Add version module also for the UDP tracker. I don't see any reason to use v1 in the http tracker but not in the UDP tracker. I will leave this until we introduce a new major version.

Sub-tasks for a new PR

I've left these tasks for a new issue. This PR is just moving things and the new tasks imply changing function signatures.

  • In the tracker-core announce handler return a Result<AnnounceData, AnnounceError> when the torrent is not included in the whitelist.
  • In the tracker-core scrape handler return a Result<ScrapeData, ScrapeError> so we are able to return errors in the future without breaking the public API.

@josecelano josecelano added Code Cleanup / Refactoring Tidying and Making Neat - Developer - Torrust Improvement Experience labels Feb 14, 2025
@josecelano josecelano requested a review from da2ce7 February 14, 2025 12:35
@josecelano josecelano self-assigned this Feb 14, 2025
@josecelano josecelano linked an issue Feb 14, 2025 that may be closed by this pull request
Copy link

codecov bot commented Feb 14, 2025

Codecov Report

Attention: Patch coverage is 97.77247% with 28 lines in your changes missing coverage. Please review.

Project coverage is 81.23%. Comparing base (2f505a8) to head (eca5c59).
Report is 10 commits behind head on develop.

Files with missing lines Patch % Lines
src/servers/udp/handlers/announce.rs 96.37% 20 Missing and 2 partials ⚠️
packages/http-protocol/src/v1/requests/announce.rs 89.47% 2 Missing ⚠️
src/servers/udp/handlers/scrape.rs 99.17% 2 Missing ⚠️
...rc/packages/http_tracker_core/services/announce.rs 96.66% 1 Missing ⚠️
src/packages/udp_tracker_core/services/announce.rs 97.82% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1269      +/-   ##
===========================================
+ Coverage    80.97%   81.23%   +0.25%     
===========================================
  Files          207      212       +5     
  Lines        14762    14891     +129     
  Branches     14762    14891     +129     
===========================================
+ Hits         11954    12096     +142     
+ Misses        2610     2604       -6     
+ Partials       198      191       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@josecelano josecelano force-pushed the 1268-overhaul-core-tracker-review-whitelist-functionality branch from 95eb3f7 to dec742e Compare February 14, 2025 14:01
@josecelano josecelano force-pushed the 1268-overhaul-core-tracker-review-whitelist-functionality branch from e01282b to e48aaf5 Compare February 14, 2025 15:48
@josecelano josecelano force-pushed the 1268-overhaul-core-tracker-review-whitelist-functionality branch from 168b5b6 to dea33ed Compare February 14, 2025 16:33
@josecelano josecelano force-pushed the 1268-overhaul-core-tracker-review-whitelist-functionality branch from dea33ed to 74815ab Compare February 14, 2025 16:34
@josecelano josecelano force-pushed the 1268-overhaul-core-tracker-review-whitelist-functionality branch from 281857a to 37a142e Compare February 14, 2025 16:47
@josecelano
Copy link
Member Author

I cant' move the authentication functionality to the http_tracker_core and udp_tracker_core yet because it forces me to move other stuff and that's out of the scope of this PR. I will do it when I extract the packages.

@josecelano
Copy link
Member Author

ACK eca5c59

@josecelano josecelano marked this pull request as ready for review February 14, 2025 17:47
@josecelano josecelano merged commit ec07b78 into torrust:develop Feb 14, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- Developer - Torrust Improvement Experience Code Cleanup / Refactoring Tidying and Making Neat
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Overhaul core Tracker: review whitelist functionality
1 participant