44//! ([`SchemaMigrator`](crate::databases::SchemaMigrator),
55//! [`TorrentMetricsStore`](crate::databases::TorrentMetricsStore),
66//! [`WhitelistStore`](crate::databases::WhitelistStore),
7- //! [`AuthKeyStore`](crate::databases::AuthKeyStore))
7+ //! [`AuthKeyStore`](crate::databases::AuthKeyStore)
88//! for `MySQL` using the `r2d2_mysql` connection pool. It configures the MySQL
99//! connection based on a URL, creates the necessary tables (for torrent metrics,
1010//! torrent whitelist, and authentication keys), and implements all CRUD
@@ -38,7 +38,6 @@ pub(crate) struct Mysql {
3838impl Mysql {
3939 /// It instantiates a new `MySQL` database driver.
4040 ///
41- /// Refer to [`databases::Database::new`](crate::core::databases::Database::new).
4241 ///
4342 /// # Errors
4443 ///
@@ -75,7 +74,6 @@ impl Mysql {
7574}
7675
7776impl SchemaMigrator for Mysql {
78- /// Refer to [`databases::Database::create_database_tables`](crate::core::databases::Database::create_database_tables).
7977 fn create_database_tables ( & self ) -> Result < ( ) , Error > {
8078 let create_whitelist_table = "
8179 CREATE TABLE IF NOT EXISTS whitelist (
@@ -125,7 +123,6 @@ impl SchemaMigrator for Mysql {
125123 Ok ( ( ) )
126124 }
127125
128- /// Refer to [`databases::Database::drop_database_tables`](crate::core::databases::Database::drop_database_tables).
129126 fn drop_database_tables ( & self ) -> Result < ( ) , Error > {
130127 let drop_whitelist_table = "
131128 DROP TABLE `whitelist`;"
@@ -152,7 +149,6 @@ impl SchemaMigrator for Mysql {
152149}
153150
154151impl TorrentMetricsStore for Mysql {
155- /// Refer to [`databases::Database::load_persistent_torrents`](crate::core::databases::Database::load_persistent_torrents).
156152 fn load_all_torrents_downloads ( & self ) -> Result < NumberOfDownloadsBTreeMap , Error > {
157153 let mut conn = self . pool . get ( ) . map_err ( |e| ( e, DRIVER ) ) ?;
158154
@@ -167,7 +163,6 @@ impl TorrentMetricsStore for Mysql {
167163 Ok ( torrents. iter ( ) . copied ( ) . collect ( ) )
168164 }
169165
170- /// Refer to [`databases::Database::load_persistent_torrent`](crate::core::databases::Database::load_persistent_torrent).
171166 fn load_torrent_downloads ( & self , info_hash : & InfoHash ) -> Result < Option < NumberOfDownloads > , Error > {
172167 let mut conn = self . pool . get ( ) . map_err ( |e| ( e, DRIVER ) ) ?;
173168
@@ -181,7 +176,6 @@ impl TorrentMetricsStore for Mysql {
181176 Ok ( persistent_torrent)
182177 }
183178
184- /// Refer to [`databases::Database::save_persistent_torrent`](crate::core::databases::Database::save_persistent_torrent).
185179 fn save_torrent_downloads ( & self , info_hash : & InfoHash , completed : u32 ) -> Result < ( ) , Error > {
186180 const COMMAND : & str = "INSERT INTO torrents (info_hash, completed) VALUES (:info_hash_str, :completed) ON DUPLICATE KEY UPDATE completed = VALUES(completed)" ;
187181
@@ -192,7 +186,6 @@ impl TorrentMetricsStore for Mysql {
192186 Ok ( conn. exec_drop ( COMMAND , params ! { info_hash_str, completed } ) ?)
193187 }
194188
195- /// Refer to [`databases::Database::increase_number_of_downloads`](crate::core::databases::Database::increase_number_of_downloads).
196189 fn increase_downloads_for_torrent ( & self , info_hash : & InfoHash ) -> Result < ( ) , Error > {
197190 let mut conn = self . pool . get ( ) . map_err ( |e| ( e, DRIVER ) ) ?;
198191
@@ -206,17 +199,14 @@ impl TorrentMetricsStore for Mysql {
206199 Ok ( ( ) )
207200 }
208201
209- /// Refer to [`databases::Database::load_global_number_of_downloads`](crate::core::databases::Database::load_global_number_of_downloads).
210202 fn load_global_downloads ( & self ) -> Result < Option < NumberOfDownloads > , Error > {
211203 self . load_torrent_aggregate_metric ( TORRENTS_DOWNLOADS_TOTAL )
212204 }
213205
214- /// Refer to [`databases::Database::save_global_number_of_downloads`](crate::core::databases::Database::save_global_number_of_downloads).
215206 fn save_global_downloads ( & self , downloaded : NumberOfDownloads ) -> Result < ( ) , Error > {
216207 self . save_torrent_aggregate_metric ( TORRENTS_DOWNLOADS_TOTAL , downloaded)
217208 }
218209
219- /// Refer to [`databases::Database::increase_global_number_of_downloads`](crate::core::databases::Database::increase_global_number_of_downloads).
220210 fn increase_global_downloads ( & self ) -> Result < ( ) , Error > {
221211 let mut conn = self . pool . get ( ) . map_err ( |e| ( e, DRIVER ) ) ?;
222212
@@ -232,7 +222,6 @@ impl TorrentMetricsStore for Mysql {
232222}
233223
234224impl WhitelistStore for Mysql {
235- /// Refer to [`databases::Database::load_whitelist`](crate::core::databases::Database::load_whitelist).
236225 fn load_whitelist ( & self ) -> Result < Vec < InfoHash > , Error > {
237226 let mut conn = self . pool . get ( ) . map_err ( |e| ( e, DRIVER ) ) ?;
238227
@@ -243,7 +232,6 @@ impl WhitelistStore for Mysql {
243232 Ok ( info_hashes)
244233 }
245234
246- /// Refer to [`databases::Database::get_info_hash_from_whitelist`](crate::core::databases::Database::get_info_hash_from_whitelist).
247235 fn get_info_hash_from_whitelist ( & self , info_hash : InfoHash ) -> Result < Option < InfoHash > , Error > {
248236 let mut conn = self . pool . get ( ) . map_err ( |e| ( e, DRIVER ) ) ?;
249237
@@ -257,7 +245,6 @@ impl WhitelistStore for Mysql {
257245 Ok ( info_hash)
258246 }
259247
260- /// Refer to [`databases::Database::add_info_hash_to_whitelist`](crate::core::databases::Database::add_info_hash_to_whitelist).
261248 fn add_info_hash_to_whitelist ( & self , info_hash : InfoHash ) -> Result < usize , Error > {
262249 let mut conn = self . pool . get ( ) . map_err ( |e| ( e, DRIVER ) ) ?;
263250
@@ -271,7 +258,6 @@ impl WhitelistStore for Mysql {
271258 Ok ( 1 )
272259 }
273260
274- /// Refer to [`databases::Database::remove_info_hash_from_whitelist`](crate::core::databases::Database::remove_info_hash_from_whitelist).
275261 fn remove_info_hash_from_whitelist ( & self , info_hash : InfoHash ) -> Result < usize , Error > {
276262 let mut conn = self . pool . get ( ) . map_err ( |e| ( e, DRIVER ) ) ?;
277263
@@ -284,7 +270,6 @@ impl WhitelistStore for Mysql {
284270}
285271
286272impl AuthKeyStore for Mysql {
287- /// Refer to [`databases::Database::load_keys`](crate::core::databases::Database::load_keys).
288273 fn load_keys ( & self ) -> Result < Vec < authentication:: PeerKey > , Error > {
289274 let mut conn = self . pool . get ( ) . map_err ( |e| ( e, DRIVER ) ) ?;
290275
@@ -305,7 +290,6 @@ impl AuthKeyStore for Mysql {
305290 Ok ( keys)
306291 }
307292
308- /// Refer to [`databases::Database::get_key_from_keys`](crate::core::databases::Database::get_key_from_keys).
309293 fn get_key_from_keys ( & self , key : & Key ) -> Result < Option < authentication:: PeerKey > , Error > {
310294 let mut conn = self . pool . get ( ) . map_err ( |e| ( e, DRIVER ) ) ?;
311295
@@ -328,7 +312,6 @@ impl AuthKeyStore for Mysql {
328312 } ) )
329313 }
330314
331- /// Refer to [`databases::Database::add_key_to_keys`](crate::core::databases::Database::add_key_to_keys).
332315 fn add_key_to_keys ( & self , auth_key : & authentication:: PeerKey ) -> Result < usize , Error > {
333316 let mut conn = self . pool . get ( ) . map_err ( |e| ( e, DRIVER ) ) ?;
334317
@@ -346,7 +329,6 @@ impl AuthKeyStore for Mysql {
346329 Ok ( 1 )
347330 }
348331
349- /// Refer to [`databases::Database::remove_key_from_keys`](crate::core::databases::Database::remove_key_from_keys).
350332 fn remove_key_from_keys ( & self , key : & Key ) -> Result < usize , Error > {
351333 let mut conn = self . pool . get ( ) . map_err ( |e| ( e, DRIVER ) ) ?;
352334
0 commit comments