@@ -462,8 +462,6 @@ use torrust_tracker_primitives::peer;
462
462
use torrust_tracker_primitives:: swarm_metadata:: SwarmMetadata ;
463
463
use torrust_tracker_primitives:: torrent_metrics:: TorrentsMetrics ;
464
464
465
- use crate :: core:: databases:: Database ;
466
-
467
465
/// The domain layer tracker service.
468
466
///
469
467
/// Its main responsibility is to handle the `announce` and `scrape` requests.
@@ -477,10 +475,6 @@ pub struct Tracker {
477
475
/// The tracker configuration.
478
476
config : Core ,
479
477
480
- /// A database driver implementation: [`Sqlite3`](crate::core::databases::sqlite)
481
- /// or [`MySQL`](crate::core::databases::mysql)
482
- database : Arc < Box < dyn Database > > ,
483
-
484
478
/// The service to check is a torrent is whitelisted.
485
479
pub whitelist_authorization : Arc < whitelist:: authorization:: Authorization > ,
486
480
@@ -544,15 +538,13 @@ impl Tracker {
544
538
/// Will return a `databases::error::Error` if unable to connect to database. The `Tracker` is responsible for the persistence.
545
539
pub fn new (
546
540
config : & Core ,
547
- database : & Arc < Box < dyn Database > > ,
548
541
whitelist_authorization : & Arc < whitelist:: authorization:: Authorization > ,
549
542
in_memory_torrent_repository : & Arc < InMemoryTorrentRepository > ,
550
543
db_torrent_repository : & Arc < DatabasePersistentTorrentRepository > ,
551
544
torrents_manager : & Arc < TorrentsManager > ,
552
545
) -> Result < Tracker , databases:: error:: Error > {
553
546
Ok ( Tracker {
554
547
config : config. clone ( ) ,
555
- database : database. clone ( ) ,
556
548
whitelist_authorization : whitelist_authorization. clone ( ) ,
557
549
in_memory_torrent_repository : in_memory_torrent_repository. clone ( ) ,
558
550
db_torrent_repository : db_torrent_repository. clone ( ) ,
@@ -739,17 +731,6 @@ impl Tracker {
739
731
pub fn cleanup_torrents ( & self ) {
740
732
self . torrents_manager . cleanup_torrents ( ) ;
741
733
}
742
-
743
- /// It drops the database tables.
744
- ///
745
- /// # Errors
746
- ///
747
- /// Will return `Err` if unable to drop tables.
748
- pub fn drop_database_tables ( & self ) -> Result < ( ) , databases:: error:: Error > {
749
- // todo: this is only used for testing. We have to pass the database
750
- // reference directly to the tests instead of via the tracker.
751
- self . database . drop_database_tables ( )
752
- }
753
734
}
754
735
755
736
#[ must_use]
@@ -787,7 +768,7 @@ mod tests {
787
768
let config = configuration:: ephemeral_public ( ) ;
788
769
789
770
let (
790
- database ,
771
+ _database ,
791
772
_in_memory_whitelist,
792
773
whitelist_authorization,
793
774
_authentication_service,
@@ -798,7 +779,6 @@ mod tests {
798
779
799
780
initialize_tracker (
800
781
& config,
801
- & database,
802
782
& whitelist_authorization,
803
783
& in_memory_torrent_repository,
804
784
& db_torrent_repository,
@@ -823,7 +803,6 @@ mod tests {
823
803
824
804
let tracker = initialize_tracker (
825
805
& config,
826
- & database,
827
806
& whitelist_authorization,
828
807
& in_memory_torrent_repository,
829
808
& db_torrent_repository,
@@ -838,7 +817,7 @@ mod tests {
838
817
config. core . tracker_policy . persistent_torrent_completed_stat = true ;
839
818
840
819
let (
841
- database ,
820
+ _database ,
842
821
_in_memory_whitelist,
843
822
whitelist_authorization,
844
823
_authentication_service,
@@ -849,7 +828,6 @@ mod tests {
849
828
850
829
initialize_tracker (
851
830
& config,
852
- & database,
853
831
& whitelist_authorization,
854
832
& in_memory_torrent_repository,
855
833
& db_torrent_repository,
0 commit comments