Skip to content

Commit bb98322

Browse files
committed
docs(tracker-core): fix broken intra-doc links in sqlite and mysql drivers
1 parent 757acbe commit bb98322

2 files changed

Lines changed: 2 additions & 37 deletions

File tree

packages/tracker-core/src/databases/driver/mysql.rs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
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 {
3838
impl 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

7776
impl 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

154151
impl 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

234224
impl 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

286272
impl 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

packages/tracker-core/src/databases/driver/sqlite.rs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
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 `SQLite3` using the `r2d2_sqlite` connection pool. It defines the schema
99
//! for whitelist, torrent metrics, and authentication keys, and provides methods
1010
//! to create and drop tables as well as perform CRUD operations on these
@@ -90,7 +90,6 @@ impl Sqlite {
9090
}
9191

9292
impl SchemaMigrator for Sqlite {
93-
/// Refer to [`databases::Database::create_database_tables`](crate::core::databases::Database::create_database_tables).
9493
fn create_database_tables(&self) -> Result<(), Error> {
9594
let create_whitelist_table = "
9695
CREATE TABLE IF NOT EXISTS whitelist (
@@ -133,7 +132,6 @@ impl SchemaMigrator for Sqlite {
133132
Ok(())
134133
}
135134

136-
/// Refer to [`databases::Database::drop_database_tables`](crate::core::databases::Database::drop_database_tables).
137135
fn drop_database_tables(&self) -> Result<(), Error> {
138136
let drop_whitelist_table = "
139137
DROP TABLE whitelist;"
@@ -158,7 +156,6 @@ impl SchemaMigrator for Sqlite {
158156
}
159157

160158
impl TorrentMetricsStore for Sqlite {
161-
/// Refer to [`databases::Database::load_persistent_torrents`](crate::core::databases::Database::load_persistent_torrents).
162159
fn load_all_torrents_downloads(&self) -> Result<NumberOfDownloadsBTreeMap, Error> {
163160
let conn = self.pool.get().map_err(|e| (e, DRIVER))?;
164161

@@ -174,7 +171,6 @@ impl TorrentMetricsStore for Sqlite {
174171
Ok(torrent_iter.filter_map(std::result::Result::ok).collect())
175172
}
176173

177-
/// Refer to [`databases::Database::load_persistent_torrent`](crate::core::databases::Database::load_persistent_torrent).
178174
fn load_torrent_downloads(&self, info_hash: &InfoHash) -> Result<Option<NumberOfDownloads>, Error> {
179175
let conn = self.pool.get().map_err(|e| (e, DRIVER))?;
180176

@@ -190,7 +186,6 @@ impl TorrentMetricsStore for Sqlite {
190186
}))
191187
}
192188

193-
/// Refer to [`databases::Database::save_persistent_torrent`](crate::core::databases::Database::save_persistent_torrent).
194189
fn save_torrent_downloads(&self, info_hash: &InfoHash, completed: u32) -> Result<(), Error> {
195190
let conn = self.pool.get().map_err(|e| (e, DRIVER))?;
196191

@@ -209,7 +204,6 @@ impl TorrentMetricsStore for Sqlite {
209204
}
210205
}
211206

212-
/// Refer to [`databases::Database::increase_number_of_downloads`](crate::core::databases::Database::increase_number_of_downloads).
213207
fn increase_downloads_for_torrent(&self, info_hash: &InfoHash) -> Result<(), Error> {
214208
let conn = self.pool.get().map_err(|e| (e, DRIVER))?;
215209

@@ -221,17 +215,14 @@ impl TorrentMetricsStore for Sqlite {
221215
Ok(())
222216
}
223217

224-
/// Refer to [`databases::Database::load_global_number_of_downloads`](crate::core::databases::Database::load_global_number_of_downloads).
225218
fn load_global_downloads(&self) -> Result<Option<NumberOfDownloads>, Error> {
226219
self.load_torrent_aggregate_metric(TORRENTS_DOWNLOADS_TOTAL)
227220
}
228221

229-
/// Refer to [`databases::Database::save_global_number_of_downloads`](crate::core::databases::Database::save_global_number_of_downloads).
230222
fn save_global_downloads(&self, downloaded: NumberOfDownloads) -> Result<(), Error> {
231223
self.save_torrent_aggregate_metric(TORRENTS_DOWNLOADS_TOTAL, downloaded)
232224
}
233225

234-
/// Refer to [`databases::Database::increase_global_number_of_downloads`](crate::core::databases::Database::increase_global_number_of_downloads).
235226
fn increase_global_downloads(&self) -> Result<(), Error> {
236227
let conn = self.pool.get().map_err(|e| (e, DRIVER))?;
237228

@@ -247,7 +238,6 @@ impl TorrentMetricsStore for Sqlite {
247238
}
248239

249240
impl WhitelistStore for Sqlite {
250-
/// Refer to [`databases::Database::load_whitelist`](crate::core::databases::Database::load_whitelist).
251241
fn load_whitelist(&self) -> Result<Vec<InfoHash>, Error> {
252242
let conn = self.pool.get().map_err(|e| (e, DRIVER))?;
253243

@@ -264,7 +254,6 @@ impl WhitelistStore for Sqlite {
264254
Ok(info_hashes)
265255
}
266256

267-
/// Refer to [`databases::Database::get_info_hash_from_whitelist`](crate::core::databases::Database::get_info_hash_from_whitelist).
268257
fn get_info_hash_from_whitelist(&self, info_hash: InfoHash) -> Result<Option<InfoHash>, Error> {
269258
let conn = self.pool.get().map_err(|e| (e, DRIVER))?;
270259

@@ -277,7 +266,6 @@ impl WhitelistStore for Sqlite {
277266
Ok(query.map(|f| InfoHash::from_str(&f.get_unwrap::<_, String>(0)).unwrap()))
278267
}
279268

280-
/// Refer to [`databases::Database::add_info_hash_to_whitelist`](crate::core::databases::Database::add_info_hash_to_whitelist).
281269
fn add_info_hash_to_whitelist(&self, info_hash: InfoHash) -> Result<usize, Error> {
282270
let conn = self.pool.get().map_err(|e| (e, DRIVER))?;
283271

@@ -293,7 +281,6 @@ impl WhitelistStore for Sqlite {
293281
}
294282
}
295283

296-
/// Refer to [`databases::Database::remove_info_hash_from_whitelist`](crate::core::databases::Database::remove_info_hash_from_whitelist).
297284
fn remove_info_hash_from_whitelist(&self, info_hash: InfoHash) -> Result<usize, Error> {
298285
let conn = self.pool.get().map_err(|e| (e, DRIVER))?;
299286

@@ -313,7 +300,6 @@ impl WhitelistStore for Sqlite {
313300
}
314301

315302
impl AuthKeyStore for Sqlite {
316-
/// Refer to [`databases::Database::load_keys`](crate::core::databases::Database::load_keys).
317303
fn load_keys(&self) -> Result<Vec<authentication::PeerKey>, Error> {
318304
let conn = self.pool.get().map_err(|e| (e, DRIVER))?;
319305

@@ -340,7 +326,6 @@ impl AuthKeyStore for Sqlite {
340326
Ok(keys)
341327
}
342328

343-
/// Refer to [`databases::Database::get_key_from_keys`](crate::core::databases::Database::get_key_from_keys).
344329
fn get_key_from_keys(&self, key: &Key) -> Result<Option<authentication::PeerKey>, Error> {
345330
let conn = self.pool.get().map_err(|e| (e, DRIVER))?;
346331

@@ -367,7 +352,6 @@ impl AuthKeyStore for Sqlite {
367352
}))
368353
}
369354

370-
/// Refer to [`databases::Database::add_key_to_keys`](crate::core::databases::Database::add_key_to_keys).
371355
fn add_key_to_keys(&self, auth_key: &authentication::PeerKey) -> Result<usize, Error> {
372356
let conn = self.pool.get().map_err(|e| (e, DRIVER))?;
373357

@@ -392,7 +376,6 @@ impl AuthKeyStore for Sqlite {
392376
}
393377
}
394378

395-
/// Refer to [`databases::Database::remove_key_from_keys`](crate::core::databases::Database::remove_key_from_keys).
396379
fn remove_key_from_keys(&self, key: &Key) -> Result<usize, Error> {
397380
let conn = self.pool.get().map_err(|e| (e, DRIVER))?;
398381

0 commit comments

Comments
 (0)