Commit c68570c
committed
Merge #1497: Overhaul stats: Improve torrent-repository package before adding events (part 1)
728de22 docs: [#1495] add todo (Jose Celano)
34c159a refactor: [#1495] update method Swarm::meets_retaining_policy (Jose Celano)
0f4596e fix: [#1495] formatting (Jose Celano)
0411a9a refactor: [#1495] rename TorrentRepository to Swarms (Jose Celano)
78d4b83 refactor: [#1495] rename TrackedTorrentHandle to SwarmHandle (Jose Celano)
030ae26 refactor: [#1495] reorganize torrent-repository mod (Jose Celano)
ca9937d refactor: [#1495] remove unneeded TrackedTorrent (wrapper over Swarm) (Jose Celano)
b6afed5 refactor: [#1495] rename methods (Jose Celano)
ef7292f refactor: [#1495] move logic from TrackedTorrent to Swarm (Jose Celano)
23ce6e4 refactor: [#1495]remove unused field in TrackedTorrent (Jose Celano)
ec597f0 refactor: [#1495] get the number of downloads from Swarm instead of from TrackedTorrent (Jose Celano)
3fb117b refactor: [#1495] initialize number of downloads in Swarm to persisted value (Jose Celano)
9b2392e refactor: [#1495] make TrackedTorrent fields private (Jose Celano)
82bbfe3 refactor: [#1495] move logic from TackedTorrent to Swarm (Jose Celano)
f73c566 refactor: [#1495] some renamings in Swarm type (Jose Celano)
61560a8 chore: add gitignore to torrent-repository pkg (Jose Celano)
0a4c805 refactor: [#1495] add SwarmMetadata to Swarm (Jose Celano)
2882705 refactor: [#1495] use SocketAddr as key for peers in Swarm (Jose Celano)
15c14c5 refactor: [#1495] rename PeerList to Swarm (Jose Celano)
cb51ec9 docs: [#1495] improve torrent-repository pkg readme (Jose Celano)
Pull request description:
Partially implements #1495
Improve `torrent-repository` package before adding events.
### Sutasks
- [x] Update README
#### Refactoring `PeerList`
- [x] Rename `PeerList` to `Swarm`.
- [x] Use `SocketAddr` as key for peers in `Swarm` instead of the `PeerId`.
- [x] Use a cache for seeders and leechers counters to avoid iterating the list.
- [x] Move logic from `TrackerTorrent` to `Swarm`
#### Refactoring `TrackedTorrent` (it was removed)
- [x] Remove the `downloaded` field from `TrackedTorrent`. The logic can be moved to `Swarm`.
- [x] Document `meets_retaining_policy` method behavior. I don't know why peerless torrents are kept when persisted stats (`downloaded` field) are enabled (only if the torrent has been downloaded at least once).
It was removed because after the refactorings, it became just a wrapper over `Swarm`.
#### Refactoring `TorrentRepository`
To be implemented in a new PR.
### New state
There are only two primary types:
- `Swarm`: a collection of peers. Peers are members of the swarm.
- `Swarms`: a collection of swarms.
```
$ tree ./src/
./src/
├── lib.rs
├── swarm.rs
└── swarms.rs
1 directory, 3 files
```
ACKs for top commit:
josecelano:
ACK 728de22
Tree-SHA512: ffe9e0cd02cb18dc657c3ec5f378ed4a17b982dfef06aed5f0274e6135d54c12fba156d8a5290c5b749ed743eca01cb3df9bcfa4d613eb1e64e2528f958e2ad622 files changed
Lines changed: 962 additions & 598 deletions
File tree
- packages
- axum-http-tracker-server/tests/server
- requests
- v1
- primitives/src
- torrent-repository
- src
- entry
- tests
- common
- entry
- repository
- tracker-core/src
- torrent
- repository
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
129 | 134 | | |
130 | 135 | | |
131 | 136 | | |
| |||
Lines changed: 36 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
109 | | - | |
| 108 | + | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| |||
559 | 559 | | |
560 | 560 | | |
561 | 561 | | |
562 | | - | |
| 562 | + | |
| 563 | + | |
563 | 564 | | |
564 | 565 | | |
565 | 566 | | |
566 | 567 | | |
567 | 568 | | |
568 | 569 | | |
569 | 570 | | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
| 571 | + | |
574 | 572 | | |
575 | 573 | | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
576 | 583 | | |
577 | 584 | | |
578 | | - | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
579 | 591 | | |
580 | | - | |
| 592 | + | |
| 593 | + | |
581 | 594 | | |
582 | | - | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
583 | 609 | | |
584 | 610 | | |
585 | 611 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
30 | 45 | | |
31 | 46 | | |
32 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
25 | 15 | | |
26 | 16 | | |
27 | 17 | | |
| |||
This file was deleted.
0 commit comments