subrepo: subdir: "apps/aquatic" merged: "34b45e92" upstream: origin: "https://github.com/greatest-ape/aquatic" branch: "master" commit: "34b45e92" git-subrepo: version: "0.4.9" origin: "???" commit: "???"
39 lines
878 B
Rust
39 lines
878 B
Rust
use std::sync::{atomic::AtomicUsize, Arc};
|
|
|
|
use rand_distr::Gamma;
|
|
|
|
pub use aquatic_http_protocol::common::*;
|
|
pub use aquatic_http_protocol::request::*;
|
|
|
|
#[derive(PartialEq, Eq, Clone)]
|
|
pub struct TorrentPeer {
|
|
pub info_hash: InfoHash,
|
|
pub scrape_hash_indeces: Vec<usize>,
|
|
pub peer_id: PeerId,
|
|
pub port: u16,
|
|
}
|
|
|
|
#[derive(Default)]
|
|
pub struct Statistics {
|
|
pub requests: AtomicUsize,
|
|
pub response_peers: AtomicUsize,
|
|
pub responses_announce: AtomicUsize,
|
|
pub responses_scrape: AtomicUsize,
|
|
pub responses_failure: AtomicUsize,
|
|
pub bytes_sent: AtomicUsize,
|
|
pub bytes_received: AtomicUsize,
|
|
}
|
|
|
|
#[derive(Clone)]
|
|
pub struct LoadTestState {
|
|
pub info_hashes: Arc<Vec<InfoHash>>,
|
|
pub statistics: Arc<Statistics>,
|
|
pub gamma: Arc<Gamma<f64>>,
|
|
}
|
|
|
|
#[derive(PartialEq, Eq, Clone, Copy)]
|
|
pub enum RequestType {
|
|
Announce,
|
|
Scrape,
|
|
}
|