Expose HTTP /stats endpoint

This commit is contained in:
Igor Katson 2024-08-21 12:20:36 +01:00
parent 5d3a93b8bd
commit 561c8b8a1d
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
5 changed files with 46 additions and 1 deletions

View file

@ -14,6 +14,7 @@ use crate::{
session::{
AddTorrent, AddTorrentOptions, AddTorrentResponse, ListOnlyResponse, Session, TorrentId,
},
session_stats::snapshot::SessionStatsSnapshot,
torrent_state::{
peer::stats::snapshot::{PeerStatsFilter, PeerStatsSnapshot},
FileStream, ManagedTorrentHandle,
@ -171,6 +172,10 @@ impl Api {
make_torrent_details(&info_hash, &handle.info().info, only_files.as_deref())
}
pub fn api_session_stats(&self) -> SessionStatsSnapshot {
self.session().stats_snapshot()
}
pub fn torrent_file_mime_type(
&self,
idx: TorrentIdOrHash,