split up librqbit torrent state into smaller files

This commit is contained in:
Igor Katson 2023-11-23 16:27:55 +00:00
parent 7cd6102c6a
commit edaf3e0997
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
17 changed files with 502 additions and 440 deletions

View file

@ -19,12 +19,12 @@ use tracing::{info, warn};
use axum::Router;
use crate::http_api_error::{ApiError, ApiErrorExt};
use crate::peer_state::PeerStatsFilter;
use crate::session::{
AddTorrent, AddTorrentOptions, AddTorrentResponse, ListOnlyResponse, Session,
};
use crate::torrent_manager::TorrentManagerHandle;
use crate::torrent_state::StatsSnapshot;
use crate::torrent_state::peer::stats::snapshot::{PeerStatsFilter, PeerStatsSnapshot};
use crate::torrent_state::stats::snapshot::StatsSnapshot;
// Public API
#[derive(Clone)]
@ -386,11 +386,7 @@ impl ApiInternal {
make_torrent_details(&info_hash, handle.torrent_state().info(), only_files)
}
fn api_peer_stats(
&self,
idx: usize,
filter: PeerStatsFilter,
) -> Result<crate::peer_state::PeerStatsSnapshot> {
fn api_peer_stats(&self, idx: usize, filter: PeerStatsFilter) -> Result<PeerStatsSnapshot> {
let handle = self.mgr_handle(idx)?;
Ok(handle.torrent_state().per_peer_stats_snapshot(filter))
}