Skip to content

Commit

Permalink
Merge #290: Crate docs for primitives package
Browse files Browse the repository at this point in the history
f78638a docs: [#279] crate docs for locate-error package (Jose Celano)

Pull request description:

  Documentation for the `primitives` package (`./package/primitives`).

Top commit has no ACKs.

Tree-SHA512: 1daff76f3acdc41df21916232c785c60a359a556867a03fe363377b9880cfd13c3668d7ec192b5fa698e4c5da83eb9c85c7decf086c7322c928ab20716ddfe7a
  • Loading branch information
josecelano committed Apr 12, 2023
2 parents a1a8491 + f78638a commit bcf7f69
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions packages/primitives/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,47 @@
//! Primitive types for [Torrust Tracker](https://docs.rs/torrust-tracker).
//!
//! This module contains the basic data structures for the [Torrust Tracker](https://docs.rs/torrust-tracker),
//! which is a `BitTorrent` tracker server. These structures are used not only
//! by the tracker server crate, but also by other crates in the Torrust
//! ecosystem.
use serde::{Deserialize, Serialize};

// TODO: Move to the database crate once that gets its own crate.
/// The database management system used by the tracker.
///
/// Refer to:
///
/// - [Torrust Tracker Configuration](https://docs.rs/torrust-tracker-configuration).
/// - [Torrust Tracker](https://docs.rs/torrust-tracker).
///
/// For more information about persistence.
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, derive_more::Display, Clone)]
pub enum DatabaseDriver {
// TODO: Move to the database crate once that gets its own crate.
/// The Sqlite3 database driver.
Sqlite3,
/// The MySQL database driver.
MySQL,
}

/// The mode the tracker will run in.
///
/// Refer to [Torrust Tracker Configuration](https://docs.rs/torrust-tracker-configuration)
/// to know how to configure the tracker to run in each mode.
#[derive(Serialize, Deserialize, Copy, Clone, PartialEq, Eq, Debug)]
pub enum TrackerMode {
// Will track every new info hash and serve every peer.
/// Will track every new info hash and serve every peer.
#[serde(rename = "public")]
Public,

// Will only track whitelisted info hashes.
/// Will only track whitelisted info hashes.
#[serde(rename = "listed")]
Listed,

// Will only serve authenticated peers
/// Will only serve authenticated peers
#[serde(rename = "private")]
Private,

// Will only track whitelisted info hashes and serve authenticated peers
/// Will only track whitelisted info hashes and serve authenticated peers
#[serde(rename = "private_listed")]
PrivateListed,
}

0 comments on commit bcf7f69

Please sign in to comment.