-
Notifications
You must be signed in to change notification settings - Fork 46
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 packages: extract announce and scrape service/handler structs #1326
Labels
Comments
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Feb 28, 2025
…es::announce::AnnounceService
5 tasks
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Feb 28, 2025
…es::announce::AnnounceService
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Feb 28, 2025
…es::announce::AnnounceService
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Feb 28, 2025
…es::scrape::ScrapeService
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Feb 28, 2025
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Feb 28, 2025
…s::connect::ConnectService
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Feb 28, 2025
…s::announce::AnnounceService
josecelano
added a commit
that referenced
this issue
Feb 28, 2025
ddb3381 refactor: rename AppContainer fields (Jose Celano) 6a83866 refactor: [1326] extract bittorrent_udp_tracker_core::services::scrape::ScrapeService (Jose Celano) 67d62ef refactor: [#1326] extract bittorrent_udp_tracker_core::services::announce::AnnounceService (Jose Celano) e1d9aa4 refactor: [#1326] extract bittorrent_udp_tracker_core::services::connect::ConnectService (Jose Celano) ddfbcd2 fix: [#1326] formatting (Jose Celano) 47e159e docs: remove deprecate comments (Jose Celano) 8ec45ad refactor: [#1326] extract bittorrent_http_tracker_core::services::scrape::ScrapeService (Jose Celano) 9cda8ec refactor: [#1326] extract bittorrent_http_tracker_core::services::announce::AnnounceService (Jose Celano) Pull request description: Refactor packages: extract announce and scrape services. ### HTTP **`http-tracker-core` package:** - [x] `bittorrent_http_tracker_core::services::announce::handle_announce` - [x] `bittorrent_http_tracker_core::services::scrape::handle_scrape` ### UDP **`udp-tracker-core` package:** - [x] `bittorrent_udp_tracker_core::services::connect::handle_connect` - [x] `bittorrent_udp_tracker_core::services::announce::handle_announce` - [x] `bittorrent_udp_tracker_core::services::scrape::handle_scrape` ACKs for top commit: josecelano: ACK ddb3381 Tree-SHA512: 753c0b1acf20c3788fbd4eefa2097063cf19d2f84409638b95e59afb5ecc5a1d54515554a7bf1337700c80dde7c40627abb16c1c4fca922a5b89b7d9452fb49c
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
There are some functions including this attribute
#[allow(clippy::too_many_arguments)]
. They are announce and scrape handlers at different app layers.HTTP
axum-http-tracker-server
package:torrust_axum_http_tracker_server::v1::handlers::announce::handle
torrust_axum_http_tracker_server::v1::handlers::announce::handle_announce
torrust_axum_http_tracker_server::v1::handlers::scrape::handle
torrust_axum_http_tracker_server::v1::handlers::scrape::handle_scrape
http-tracker-core
package:bittorrent_http_tracker_core::services::announce::handle_announce
bittorrent_http_tracker_core::services::scrape::handle_scrape
UDP
udp-tracker-core
package:bittorrent_udp_tracker_core::services::announce::handle_announce
bittorrent_udp_tracker_core::services::scrape::handle_scrape
(this does not have thetoo_many_arguments
attribute)udp-tracker-server
package:torrust_udp_tracker_server::handlers::announce::handle_announce
torrust_udp_tracker_server::handlers::scrape::handle:scrape
(this does not have thetoo_many_arguments
attribute)torrust_udp_tracker_server::handlers::error::handle_error
They have many arguments because the services/handlers are implemented as functions not types. So we need to pass all the dependencies to the function from the main
AppContainer
down to the service/handler function. We can create structs and pass the dependencies in the constructor. That will simplify the announce/scrape functions, improving the core and removing the clippy warning.AI generated example
As an example I asked an AI model to refactor one of the modules (bittorrent_http_tracker_core::services::announce).
NOTE: I have not only asked to create the struct but also to improve the code in the main function. We can do both things as there is no extra effort and It will be good when we start adding unit tests to all the packages.
AI model:
deepseek/deepseek-r1
Prompt
Response
cc @da2ce7
The text was updated successfully, but these errors were encountered: