-
Notifications
You must be signed in to change notification settings - Fork 51
Overhaul core Tracker: remove complexity (type_complexity) #1215
Copy link
Copy link
Labels
- Developer -Torrust Improvement ExperienceTorrust Improvement ExperienceCode Cleanup / RefactoringTidying and Making NeatTidying and Making Neat
Description
Parent issue: #1181
After removing the core Tracker we don't need anymore functions like these:
/// Initialize the tracker dependencies.
#[allow(clippy::type_complexity)]
#[must_use]
pub fn initialize_tracker_dependencies(
config: &Configuration,
) -> (
Arc<Box<dyn Database>>,
Arc<InMemoryWhitelist>,
Arc<whitelist::authorization::WhitelistAuthorization>,
Arc<AuthenticationService>,
Arc<InMemoryTorrentRepository>,
Arc<DatabasePersistentTorrentRepository>,
Arc<TorrentsManager>,
) {
let database = initialize_database(config);
let in_memory_whitelist = Arc::new(InMemoryWhitelist::default());
let whitelist_authorization = Arc::new(whitelist::authorization::WhitelistAuthorization::new(
&config.core,
&in_memory_whitelist.clone(),
));
let db_key_repository = Arc::new(DatabaseKeyRepository::new(&database));
let in_memory_key_repository = Arc::new(InMemoryKeyRepository::default());
let authentication_service = Arc::new(service::AuthenticationService::new(&config.core, &in_memory_key_repository));
let _keys_handler = Arc::new(KeysHandler::new(
&db_key_repository.clone(),
&in_memory_key_repository.clone(),
));
let in_memory_torrent_repository = Arc::new(InMemoryTorrentRepository::default());
let db_torrent_repository = Arc::new(DatabasePersistentTorrentRepository::new(&database));
let torrents_manager = Arc::new(TorrentsManager::new(
&config.core,
&in_memory_torrent_repository,
&db_torrent_repository,
));
(
database,
in_memory_whitelist,
whitelist_authorization,
authentication_service,
in_memory_torrent_repository,
db_torrent_repository,
torrents_manager,
)
}We only need to instantiate the dependencies for the services we actually need. That kind of functions were used to instantiate the tracker with all its dependencies.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
- Developer -Torrust Improvement ExperienceTorrust Improvement ExperienceCode Cleanup / RefactoringTidying and Making NeatTidying and Making Neat