Files

42 lines
1.5 KiB
Rust

#![expect(
clippy::redundant_pub_crate,
reason = "private criterion bench modules share fixtures through pub(super) support exports"
)]
pub(super) use std::{
collections::BTreeMap,
fs,
io::{Read, Write},
net::{SocketAddr, TcpListener, TcpStream},
path::PathBuf,
sync::{
Arc, Mutex,
atomic::{AtomicBool, Ordering},
},
thread,
time::{Duration, Instant, SystemTime, UNIX_EPOCH},
};
pub(super) use aria2_rust_pro_cli::{Invocation, execute_runtime_with_downloader};
pub(super) use aria2_rust_pro_core::{
DownloadEngine, DownloadStatus, PieceId, PieceState, RuntimeConfig,
};
pub(super) use aria2_rust_pro_protocol::{
ReqwestHttpConnector, TorrentPeerModel, TrackerPeerListModel, TrackerResponseModel,
downloader::ConnectorBackedDownloader,
};
pub(super) use aria2_rust_pro_rpc::{InProcessRpcDispatcher, JsonRpcRequest, RpcMethod, RpcValue};
pub(super) use criterion::{BenchmarkId, Criterion, Throughput};
pub(super) const BT_TORRENT_FIXTURE: &str = "ZDg6YW5ub3VuY2UzNTpodHRwOi8vdHJhY2tlci5leGFtcGxlLm9yZy9hbm5vdW5jZTQ6aW5mb2Q0Om5hbWUxMDp1YnVudHUuaXNvMTI6cGllY2UgbGVuZ3RoaTE2Mzg0ZTY6bGVuZ3RoaTMyNzY4ZTY6cGllY2VzNDA6YWFhYWFhYWFhYWFhYWFhYWFhYWFiYmJiYmJiYmJiYmJiYmJiYmJiYmVl";
pub(super) fn rpc_request(method: RpcMethod, params: Vec<RpcValue>) -> JsonRpcRequest {
JsonRpcRequest {
jsonrpc: Some("2.0".to_owned()),
id: None,
method: method.as_str().to_owned(),
params,
meta: Default::default(),
}
}