Skip to content

Commit 3a2e8f0

Browse files
committed
refactor: [torrust#1201] reorganize methods in tracker
Grouping similar methods.
1 parent b3fcdb4 commit 3a2e8f0

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

src/core/mod.rs

+22-22
Original file line numberDiff line numberDiff line change
@@ -653,28 +653,6 @@ impl Tracker {
653653
scrape_data
654654
}
655655

656-
/// It returns the data for a `scrape` response.
657-
fn get_swarm_metadata(&self, info_hash: &InfoHash) -> SwarmMetadata {
658-
self.in_memory_torrent_repository.get_swarm_metadata(info_hash)
659-
}
660-
661-
/// # Context: Tracker
662-
///
663-
/// Get torrent peers for a given torrent and client.
664-
///
665-
/// It filters out the client making the request.
666-
fn get_peers_for(&self, info_hash: &InfoHash, peer: &peer::Peer, limit: usize) -> Vec<Arc<peer::Peer>> {
667-
self.in_memory_torrent_repository.get_peers_for(info_hash, peer, limit)
668-
}
669-
670-
/// # Context: Tracker
671-
///
672-
/// Get torrent peers for a given torrent.
673-
#[must_use]
674-
pub fn get_torrent_peers(&self, info_hash: &InfoHash) -> Vec<Arc<peer::Peer>> {
675-
self.in_memory_torrent_repository.get_torrent_peers(info_hash)
676-
}
677-
678656
/// It updates the torrent entry in memory, it also stores in the database
679657
/// the torrent info data which is persistent, and finally return the data
680658
/// needed for a `announce` request response.
@@ -713,6 +691,28 @@ impl Tracker {
713691
}
714692
}
715693

694+
/// It returns the data for a `scrape` response.
695+
fn get_swarm_metadata(&self, info_hash: &InfoHash) -> SwarmMetadata {
696+
self.in_memory_torrent_repository.get_swarm_metadata(info_hash)
697+
}
698+
699+
/// # Context: Tracker
700+
///
701+
/// Get torrent peers for a given torrent and client.
702+
///
703+
/// It filters out the client making the request.
704+
fn get_peers_for(&self, info_hash: &InfoHash, peer: &peer::Peer, limit: usize) -> Vec<Arc<peer::Peer>> {
705+
self.in_memory_torrent_repository.get_peers_for(info_hash, peer, limit)
706+
}
707+
708+
/// # Context: Tracker
709+
///
710+
/// Get torrent peers for a given torrent.
711+
#[must_use]
712+
pub fn get_torrent_peers(&self, info_hash: &InfoHash) -> Vec<Arc<peer::Peer>> {
713+
self.in_memory_torrent_repository.get_torrent_peers(info_hash)
714+
}
715+
716716
/// It calculates and returns the general `Tracker`
717717
/// [`TorrentsMetrics`]
718718
///

0 commit comments

Comments
 (0)