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: remove deprecated core::Tracker #1212

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading