-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #1188: Overhaul core Tracker: extract IoC Container
20018ab fix: [#1187] doc link error (Jose Celano) 3d0f4f8 refactor: [#1187] use AppContainer in test environments (Jose Celano) c45a12b refactor: [#1187] rename fn tracker_factory to initialize_tracker (Jose Celano) aa9f1c3 refactor: [#1187] move fn initialize_tracker_dependencies (Jose Celano) a4d8da0 refactor: [#1187] inline fn initialize_tracker (Jose Celano) 36db088 refactor: [#1187] inline fn initialize_globals_and_tracker (Jose Celano) 4aea9db refactor: [#1187] extract fn initialize_app_container (Jose Celano) 747b58d refactor: [#1187] extract one function and rename another one (Jose Celano) 8bea521 refactor: [#1187] extract IoC Container (Jose Celano) Pull request description: Overhaul core Tracker: extract IoC Container ACKs for top commit: josecelano: ACK 20018ab Tree-SHA512: 5bb7d6fc2f3e577547b1532b3267f3f1d7eddd938b883a6a3fb31a3a3bd0e3b8001325e3c6d45261da46c34fd2c4312b627abc0054efd7097e1721375b325b5f
- Loading branch information
Showing
24 changed files
with
205 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//! This file contains only functions used for testing. | ||
use std::sync::Arc; | ||
|
||
use torrust_tracker_configuration::Configuration; | ||
|
||
use crate::core::databases::Database; | ||
use crate::core::services::{initialize_database, initialize_whitelist}; | ||
use crate::core::whitelist::WhiteListManager; | ||
|
||
/// Initialize the tracker dependencies. | ||
#[allow(clippy::type_complexity)] | ||
#[must_use] | ||
pub fn initialize_tracker_dependencies(config: &Configuration) -> (Arc<Box<dyn Database>>, Arc<WhiteListManager>) { | ||
let database = initialize_database(config); | ||
let whitelist_manager = initialize_whitelist(database.clone()); | ||
|
||
(database, whitelist_manager) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use std::sync::Arc; | ||
|
||
use tokio::sync::RwLock; | ||
|
||
use crate::core::statistics::event::sender::Sender; | ||
use crate::core::statistics::repository::Repository; | ||
use crate::core::whitelist::WhiteListManager; | ||
use crate::core::Tracker; | ||
use crate::servers::udp::server::banning::BanService; | ||
|
||
pub struct AppContainer { | ||
pub tracker: Arc<Tracker>, | ||
pub ban_service: Arc<RwLock<BanService>>, | ||
pub stats_event_sender: Arc<Option<Box<dyn Sender>>>, | ||
pub stats_repository: Arc<Repository>, | ||
pub whitelist_manager: Arc<WhiteListManager>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.