Skip to content

Commit

Permalink
Merge #1212: Overhaul core Tracker: remove deprecated core::Tracker
Browse files Browse the repository at this point in the history
73560a5 refactor: [#1209] remove core::Tracker (Jose Celano)

Pull request description:

  Overhaul core Tracker: remove deprecated `core::Tracker`.

  This is a missing commit in [this PR](https://github.com/torrust/torrust-tracker/pull/1210/commits). I forgot to push the commit before merging that PR.

ACKs for top commit:
  josecelano:
    ACK 73560a5

Tree-SHA512: b5f9566c226bf799f2db24ee5b99d44fd7583d1f68b4fbea697158603a20f4ce533581a8c15049d6a731e41160eac5388d045d03b0a32190abc70741d37fee32
  • Loading branch information
josecelano committed Jan 27, 2025
2 parents 00f6855 + 73560a5 commit 17bea24
Show file tree
Hide file tree
Showing 25 changed files with 119 additions and 497 deletions.
2 changes: 0 additions & 2 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ pub async fn start(config: &Configuration, app_container: &AppContainer) -> Vec<
udp_tracker::start_job(
Arc::new(config.core.clone()),
udp_tracker_config,
app_container.tracker.clone(),
app_container.announce_handler.clone(),
app_container.scrape_handler.clone(),
app_container.whitelist_authorization.clone(),
Expand All @@ -104,7 +103,6 @@ pub async fn start(config: &Configuration, app_container: &AppContainer) -> Vec<
if let Some(job) = http_tracker::start_job(
http_tracker_config,
Arc::new(config.core.clone()),
app_container.tracker.clone(),
app_container.announce_handler.clone(),
app_container.scrape_handler.clone(),
app_container.authentication_service.clone(),
Expand Down
9 changes: 1 addition & 8 deletions src/bootstrap/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use crate::core::authentication::key::repository::in_memory::InMemoryKeyReposito
use crate::core::authentication::key::repository::persisted::DatabaseKeyRepository;
use crate::core::authentication::service;
use crate::core::scrape_handler::ScrapeHandler;
use crate::core::services::{initialize_database, initialize_tracker, initialize_whitelist_manager, statistics};
use crate::core::services::{initialize_database, initialize_whitelist_manager, statistics};
use crate::core::torrent::manager::TorrentsManager;
use crate::core::torrent::repository::in_memory::InMemoryTorrentRepository;
use crate::core::torrent::repository::persisted::DatabasePersistentTorrentRepository;
Expand Down Expand Up @@ -116,12 +116,6 @@ pub fn initialize_app_container(configuration: &Configuration) -> AppContainer {
&db_torrent_repository,
));

let tracker = Arc::new(initialize_tracker(
configuration,
&in_memory_torrent_repository,
&db_torrent_repository,
));

let announce_handler = Arc::new(AnnounceHandler::new(
&configuration.core,
&in_memory_torrent_repository,
Expand All @@ -132,7 +126,6 @@ pub fn initialize_app_container(configuration: &Configuration) -> AppContainer {

AppContainer {
database,
tracker,
announce_handler,
scrape_handler,
keys_handler,
Expand Down
9 changes: 1 addition & 8 deletions src/bootstrap/jobs/http_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::core::announce_handler::AnnounceHandler;
use crate::core::authentication::service::AuthenticationService;
use crate::core::scrape_handler::ScrapeHandler;
use crate::core::statistics::event::sender::Sender;
use crate::core::{self, statistics, whitelist};
use crate::core::{statistics, whitelist};
use crate::servers::http::server::{HttpServer, Launcher};
use crate::servers::http::Version;
use crate::servers::registar::ServiceRegistrationForm;
Expand All @@ -39,7 +39,6 @@ use crate::servers::registar::ServiceRegistrationForm;
#[allow(clippy::too_many_arguments)]
#[instrument(skip(
config,
tracker,
announce_handler,
scrape_handler,
authentication_service,
Expand All @@ -50,7 +49,6 @@ use crate::servers::registar::ServiceRegistrationForm;
pub async fn start_job(
config: &HttpTracker,
core_config: Arc<Core>,
tracker: Arc<core::Tracker>,
announce_handler: Arc<AnnounceHandler>,
scrape_handler: Arc<ScrapeHandler>,
authentication_service: Arc<AuthenticationService>,
Expand All @@ -71,7 +69,6 @@ pub async fn start_job(
socket,
tls,
core_config.clone(),
tracker.clone(),
announce_handler.clone(),
scrape_handler.clone(),
authentication_service.clone(),
Expand All @@ -89,7 +86,6 @@ pub async fn start_job(
#[instrument(skip(
socket,
tls,
tracker,
announce_handler,
scrape_handler,
whitelist_authorization,
Expand All @@ -100,7 +96,6 @@ async fn start_v1(
socket: SocketAddr,
tls: Option<RustlsConfig>,
config: Arc<Core>,
tracker: Arc<core::Tracker>,
announce_handler: Arc<AnnounceHandler>,
scrape_handler: Arc<ScrapeHandler>,
authentication_service: Arc<AuthenticationService>,
Expand All @@ -111,7 +106,6 @@ async fn start_v1(
let server = HttpServer::new(Launcher::new(socket, tls))
.start(
config,
tracker,
announce_handler,
scrape_handler,
authentication_service,
Expand Down Expand Up @@ -161,7 +155,6 @@ mod tests {
start_job(
config,
Arc::new(cfg.core.clone()),
app_container.tracker,
app_container.announce_handler,
app_container.scrape_handler,
app_container.authentication_service,
Expand Down
5 changes: 1 addition & 4 deletions src/bootstrap/jobs/udp_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use tracing::instrument;
use crate::core::announce_handler::AnnounceHandler;
use crate::core::scrape_handler::ScrapeHandler;
use crate::core::statistics::event::sender::Sender;
use crate::core::{self, whitelist};
use crate::core::whitelist;
use crate::servers::registar::ServiceRegistrationForm;
use crate::servers::udp::server::banning::BanService;
use crate::servers::udp::server::spawner::Spawner;
Expand All @@ -37,7 +37,6 @@ use crate::servers::udp::UDP_TRACKER_LOG_TARGET;
#[allow(clippy::async_yields_async)]
#[instrument(skip(
config,
tracker,
announce_handler,
scrape_handler,
whitelist_authorization,
Expand All @@ -48,7 +47,6 @@ use crate::servers::udp::UDP_TRACKER_LOG_TARGET;
pub async fn start_job(
core_config: Arc<Core>,
config: &UdpTracker,
tracker: Arc<core::Tracker>,
announce_handler: Arc<AnnounceHandler>,
scrape_handler: Arc<ScrapeHandler>,
whitelist_authorization: Arc<whitelist::authorization::Authorization>,
Expand All @@ -62,7 +60,6 @@ pub async fn start_job(
let server = Server::new(Spawner::new(bind_to))
.start(
core_config,
tracker,
announce_handler,
scrape_handler,
whitelist_authorization,
Expand Down
3 changes: 1 addition & 2 deletions src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ use crate::core::statistics::repository::Repository;
use crate::core::torrent::manager::TorrentsManager;
use crate::core::torrent::repository::in_memory::InMemoryTorrentRepository;
use crate::core::torrent::repository::persisted::DatabasePersistentTorrentRepository;
use crate::core::whitelist;
use crate::core::whitelist::manager::WhiteListManager;
use crate::core::{whitelist, Tracker};
use crate::servers::udp::server::banning::BanService;

pub struct AppContainer {
pub database: Arc<Box<dyn Database>>,
pub tracker: Arc<Tracker>,
pub announce_handler: Arc<AnnounceHandler>,
pub scrape_handler: Arc<ScrapeHandler>,
pub keys_handler: Arc<KeysHandler>,
Expand Down
Loading

0 comments on commit 17bea24

Please sign in to comment.