|
422 | 422 | //! For example, the HTTP tracker would send an event like the following when it handles an `announce` request received from a peer using IP version 4.
|
423 | 423 | //!
|
424 | 424 | //! ```text
|
425 |
| -//! tracker.send_stats_event(statistics::Event::Tcp4Announce).await |
| 425 | +//! tracker.send_stats_event(statistics::event::Event::Tcp4Announce).await |
426 | 426 | //! ```
|
427 | 427 | //!
|
428 | 428 | //! Refer to [`statistics`] module for more information about statistics.
|
@@ -505,10 +505,10 @@ pub struct Tracker {
|
505 | 505 | torrents: Arc<Torrents>,
|
506 | 506 |
|
507 | 507 | /// Service to send stats events.
|
508 |
| - stats_event_sender: Option<Box<dyn statistics::EventSender>>, |
| 508 | + stats_event_sender: Option<Box<dyn statistics::event::sender::Sender>>, |
509 | 509 |
|
510 | 510 | /// The in-memory stats repo.
|
511 |
| - stats_repository: statistics::Repo, |
| 511 | + stats_repository: statistics::repository::Repository, |
512 | 512 | }
|
513 | 513 |
|
514 | 514 | /// Structure that holds the data returned by the `announce` request.
|
@@ -624,8 +624,8 @@ impl Tracker {
|
624 | 624 | /// Will return a `databases::error::Error` if unable to connect to database. The `Tracker` is responsible for the persistence.
|
625 | 625 | pub fn new(
|
626 | 626 | config: &Core,
|
627 |
| - stats_event_sender: Option<Box<dyn statistics::EventSender>>, |
628 |
| - stats_repository: statistics::Repo, |
| 627 | + stats_event_sender: Option<Box<dyn statistics::event::sender::Sender>>, |
| 628 | + stats_repository: statistics::repository::Repository, |
629 | 629 | ) -> Result<Tracker, databases::error::Error> {
|
630 | 630 | let driver = match config.database.driver {
|
631 | 631 | database::Driver::Sqlite3 => Driver::Sqlite3,
|
@@ -1207,17 +1207,20 @@ impl Tracker {
|
1207 | 1207 | Ok(())
|
1208 | 1208 | }
|
1209 | 1209 |
|
1210 |
| - /// It return the `Tracker` [`statistics::Metrics`]. |
| 1210 | + /// It return the `Tracker` [`statistics::metrics::Metrics`]. |
1211 | 1211 | ///
|
1212 | 1212 | /// # Context: Statistics
|
1213 |
| - pub async fn get_stats(&self) -> tokio::sync::RwLockReadGuard<'_, statistics::Metrics> { |
| 1213 | + pub async fn get_stats(&self) -> tokio::sync::RwLockReadGuard<'_, statistics::metrics::Metrics> { |
1214 | 1214 | self.stats_repository.get_stats().await
|
1215 | 1215 | }
|
1216 | 1216 |
|
1217 |
| - /// It allows to send a statistic events which eventually will be used to update [`statistics::Metrics`]. |
| 1217 | + /// It allows to send a statistic events which eventually will be used to update [`statistics::metrics::Metrics`]. |
1218 | 1218 | ///
|
1219 | 1219 | /// # Context: Statistics
|
1220 |
| - pub async fn send_stats_event(&self, event: statistics::Event) -> Option<Result<(), SendError<statistics::Event>>> { |
| 1220 | + pub async fn send_stats_event( |
| 1221 | + &self, |
| 1222 | + event: statistics::event::Event, |
| 1223 | + ) -> Option<Result<(), SendError<statistics::event::Event>>> { |
1221 | 1224 | match &self.stats_event_sender {
|
1222 | 1225 | None => None,
|
1223 | 1226 | Some(stats_event_sender) => stats_event_sender.send_event(event).await,
|
|
0 commit comments