@@ -12,11 +12,11 @@ use torrust_tracker_primitives::{peer, DurationSinceUnixEpoch, NumberOfDownloads
1212use crate :: event:: sender:: Sender ;
1313use crate :: event:: Event ;
1414use crate :: swarm:: coordinator:: Coordinator ;
15- use crate :: SwarmHandle ;
15+ use crate :: CoordinatorHandle ;
1616
1717#[ derive( Default ) ]
1818pub struct Registry {
19- swarms : SkipMap < InfoHash , SwarmHandle > ,
19+ swarms : SkipMap < InfoHash , CoordinatorHandle > ,
2020 event_sender : Sender ,
2121}
2222
@@ -60,7 +60,7 @@ impl Registry {
6060 let number_of_downloads = opt_persistent_torrent. unwrap_or_default ( ) ;
6161
6262 let new_swarm_handle =
63- SwarmHandle :: new ( Coordinator :: new ( info_hash, number_of_downloads, self . event_sender . clone ( ) ) . into ( ) ) ;
63+ CoordinatorHandle :: new ( Coordinator :: new ( info_hash, number_of_downloads, self . event_sender . clone ( ) ) . into ( ) ) ;
6464
6565 let new_swarm_handle = self . swarms . get_or_insert ( * info_hash, new_swarm_handle) ;
6666
@@ -107,7 +107,7 @@ impl Registry {
107107 ///
108108 /// An `Option` containing the removed torrent entry if it existed.
109109 #[ must_use]
110- pub async fn remove ( & self , key : & InfoHash ) -> Option < SwarmHandle > {
110+ pub async fn remove ( & self , key : & InfoHash ) -> Option < CoordinatorHandle > {
111111 let swarm_handle = self . swarms . remove ( key) . map ( |entry| entry. value ( ) . clone ( ) ) ;
112112
113113 if let Some ( event_sender) = self . event_sender . as_deref ( ) {
@@ -123,7 +123,7 @@ impl Registry {
123123 ///
124124 /// An `Option` containing the tracked torrent handle if found.
125125 #[ must_use]
126- pub fn get ( & self , key : & InfoHash ) -> Option < SwarmHandle > {
126+ pub fn get ( & self , key : & InfoHash ) -> Option < CoordinatorHandle > {
127127 let maybe_entry = self . swarms . get ( key) ;
128128 maybe_entry. map ( |entry| entry. value ( ) . clone ( ) )
129129 }
@@ -138,7 +138,7 @@ impl Registry {
138138 ///
139139 /// A vector of `(InfoHash, TorrentEntry)` tuples.
140140 #[ must_use]
141- pub fn get_paginated ( & self , pagination : Option < & Pagination > ) -> Vec < ( InfoHash , SwarmHandle ) > {
141+ pub fn get_paginated ( & self , pagination : Option < & Pagination > ) -> Vec < ( InfoHash , CoordinatorHandle ) > {
142142 match pagination {
143143 Some ( pagination) => self
144144 . swarms
@@ -366,7 +366,7 @@ impl Registry {
366366 continue ;
367367 }
368368
369- let entry = SwarmHandle :: new ( Coordinator :: new ( info_hash, * completed, self . event_sender . clone ( ) ) . into ( ) ) ;
369+ let entry = CoordinatorHandle :: new ( Coordinator :: new ( info_hash, * completed, self . event_sender . clone ( ) ) . into ( ) ) ;
370370
371371 // Since SkipMap is lock-free the torrent could have been inserted
372372 // after checking if it exists.
@@ -853,7 +853,7 @@ mod tests {
853853
854854 use crate :: swarm:: registry:: Registry ;
855855 use crate :: tests:: { sample_info_hash, sample_peer} ;
856- use crate :: { Coordinator , SwarmHandle } ;
856+ use crate :: { Coordinator , CoordinatorHandle } ;
857857
858858 /// `TorrentEntry` data is not directly accessible. It's only
859859 /// accessible through the trait methods. We need this temporary
@@ -865,7 +865,7 @@ mod tests {
865865 number_of_peers : usize ,
866866 }
867867
868- async fn torrent_entry_info ( swarm_handle : SwarmHandle ) -> TorrentEntryInfo {
868+ async fn torrent_entry_info ( swarm_handle : CoordinatorHandle ) -> TorrentEntryInfo {
869869 let torrent_guard = swarm_handle. lock ( ) . await ;
870870 torrent_guard. clone ( ) . into ( )
871871 }
0 commit comments