Refactor: segregate command and query for announce request#792
Merged
josecelano merged 1 commit intotorrust:developfrom Apr 15, 2024
Merged
Refactor: segregate command and query for announce request#792josecelano merged 1 commit intotorrust:developfrom
josecelano merged 1 commit intotorrust:developfrom
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #792 +/- ##
===========================================
- Coverage 78.16% 78.15% -0.02%
===========================================
Files 159 159
Lines 8863 8857 -6
===========================================
- Hits 6928 6922 -6
Misses 1935 1935 ☔ View full report in Codecov by Sentry. |
b928cb2 to
dc78a81
Compare
This changes the API of the torrent repository. The method:
```
fn update_torrent_with_peer_and_get_stats(&self, info_hash: &InfoHash, peer: &peer::Peer) -> (bool, SwarmMetadata);
```
is replaced with:
```
fn upsert_peer(&self, info_hash: &InfoHash, peer: &peer::Peer);
fn get_swarm_metadata(&self, info_hash: &InfoHash) -> Option<SwarmMetadata>;
```
The performance is not affected. Benchmaring is still using both methods
in order to simulate `announce` requests.
1. The interface is simpler (command/query segregation.
2. In the long-term:
- Returning swarm metadata in the announce request could be
optional. The announce request process would be faster if the
tracker does not have to mantain the swarm data. This is not likely to
happen becuase the scrape request needs this metadata.
- New repository performance improvements could be implemented. This allow
decoupling peer lists from swarm metadata. The repository
internally can have two data strcutures one for the peer list and
another for the swarm metatada. Both using different locks.
dc78a81 to
aa4bfba
Compare
Member
Author
|
ACK aa4bfba |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This changes the API of the torrent repository.
The method:
is replaced with two methods (command and query):
The performance is not affected. Bechmarking is still using both methods in order to simulate
announcerequests.The interface is simpler (command/query segregation).