KanoopTorrentQt 0.1.0
Qt6 wrapper library for libtorrent-rasterbar
Loading...
Searching...
No Matches
sessionstats.h
1#ifndef SESSIONSTATS_H
2#define SESSIONSTATS_H
3
4#include <Kanoop/torrent/kanooptorrent.h>
5#include <QtGlobal>
6
7/**
8 * @brief Aggregate statistics snapshot for a TorrentClient session.
9 *
10 * SessionStats is a lightweight value class that captures a point-in-time
11 * view of session-wide transfer totals, rates, peer counts, and DHT state.
12 * Obtain one via TorrentClient::sessionStats() or the
13 * TorrentClient::sessionStatsReceived() signal.
14 */
15class LIBKANOOPTORRENT_EXPORT SessionStats
16{
17public:
18 SessionStats() = default;
19
20 // ── Transfer totals ─────────────────────────────────────────────────
21
22 /** @brief Total bytes downloaded across all torrents since session start. */
23 qint64 totalDownloaded() const { return _totalDownloaded; }
24 void setTotalDownloaded(qint64 value) { _totalDownloaded = value; }
25
26 /** @brief Total bytes uploaded across all torrents since session start. */
27 qint64 totalUploaded() const { return _totalUploaded; }
28 void setTotalUploaded(qint64 value) { _totalUploaded = value; }
29
30 // ── Transfer rates ──────────────────────────────────────────────────
31
32 /** @brief Combined download rate in bytes/sec across all torrents. */
33 qint64 downloadRate() const { return _downloadRate; }
34 void setDownloadRate(qint64 value) { _downloadRate = value; }
35
36 /** @brief Combined upload rate in bytes/sec across all torrents. */
37 qint64 uploadRate() const { return _uploadRate; }
38 void setUploadRate(qint64 value) { _uploadRate = value; }
39
40 // ── Peers ───────────────────────────────────────────────────────────
41
42 /** @brief Total number of connected peers across all torrents. */
43 int totalPeers() const { return _totalPeers; }
44 void setTotalPeers(int value) { _totalPeers = value; }
45
46 // ── DHT ─────────────────────────────────────────────────────────────
47
48 /** @brief Number of nodes in the DHT routing table (IPv4 + IPv6). */
49 int dhtNodes() const { return _dhtNodes; }
50 void setDhtNodes(int value) { _dhtNodes = value; }
51
52 // ── Torrent counts ──────────────────────────────────────────────────
53
54 /** @brief Number of torrents currently downloading or seeding. */
55 int activeTorrents() const { return _activeTorrents; }
56 void setActiveTorrents(int value) { _activeTorrents = value; }
57
58 /** @brief Number of paused torrents. */
59 int pausedTorrents() const { return _pausedTorrents; }
60 void setPausedTorrents(int value) { _pausedTorrents = value; }
61
62private:
63 qint64 _totalDownloaded = 0;
64 qint64 _totalUploaded = 0;
65 qint64 _downloadRate = 0;
66 qint64 _uploadRate = 0;
67 int _totalPeers = 0;
68 int _dhtNodes = 0;
69 int _activeTorrents = 0;
70 int _pausedTorrents = 0;
71};
72
73#endif // SESSIONSTATS_H
Aggregate statistics snapshot for a TorrentClient session.
qint64 downloadRate() const
Combined download rate in bytes/sec across all torrents.
qint64 totalDownloaded() const
Total bytes downloaded across all torrents since session start.
int dhtNodes() const
Number of nodes in the DHT routing table (IPv4 + IPv6).
int activeTorrents() const
Number of torrents currently downloading or seeding.
qint64 uploadRate() const
Combined upload rate in bytes/sec across all torrents.
int pausedTorrents() const
Number of paused torrents.
int totalPeers() const
Total number of connected peers across all torrents.
qint64 totalUploaded() const
Total bytes uploaded across all torrents since session start.