1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! User account entry for private tracker functionality.
use BTreeMap;
use ;
use crateInfoHash;
use crateUserId;
/// User account information for private tracker mode.
///
/// `UserEntryItem` stores per-user statistics and settings for private tracker
/// functionality. Each user is identified by a unique passkey and can have
/// their upload/download tracked for ratio enforcement.
///
/// # Statistics Tracking
///
/// The tracker maintains cumulative statistics for each user:
/// - `uploaded`: Total bytes uploaded across all torrents
/// - `downloaded`: Total bytes downloaded across all torrents
/// - `completed`: Number of torrents fully downloaded (snatched)
///
/// # Active Torrents
///
/// The `torrents_active` map tracks which torrents the user is currently
/// participating in, along with timestamps for activity tracking.
///
/// # Example
///
/// ```rust,ignore
/// use torrust_actix::tracker::structs::user_entry_item::UserEntryItem;
///
/// // Calculate user ratio
/// let ratio = if user.downloaded > 0 {
/// user.uploaded as f64 / user.downloaded as f64
/// } else {
/// f64::INFINITY
/// };
/// ```