Skip to content

Conversation

@josecelano
Copy link
Member

@josecelano josecelano commented May 7, 2025

Improve torrent-repository package before adding events.

This is a continuation of tracker/issues/1495.

Refactoring TorrentRepository

  • Return errors instead of panicking in Swarms type.
  • Make field swarms private.
  • Add len and is_empty methods.
  • Refactor upsert_peer.
  • Renamings to follow the latest changes in type names.

Integration tests will be removed becuase unit tests have been added.
Besides, there is no point in testing only the wrapper. SwarmHandle in
only a wrapper over Swarm.
@josecelano josecelano self-assigned this May 7, 2025
@josecelano josecelano requested a review from da2ce7 May 7, 2025 09:06
@josecelano josecelano added the Code Cleanup / Refactoring Tidying and Making Neat label May 7, 2025
@codecov
Copy link

codecov bot commented May 7, 2025

Codecov Report

Attention: Patch coverage is 89.71429% with 18 lines in your changes missing coverage. Please review.

Project coverage is 83.75%. Comparing base (c68570c) to head (4d91738).
Report is 8 commits behind head on develop.

Files with missing lines Patch % Lines
packages/torrent-repository/src/swarms.rs 88.00% 10 Missing and 8 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1500      +/-   ##
===========================================
- Coverage    85.05%   83.75%   -1.31%     
===========================================
  Files          258      257       -1     
  Lines        20546    17837    -2709     
  Branches     20546    17837    -2709     
===========================================
- Hits         17476    14939    -2537     
+ Misses        2781     2623     -158     
+ Partials       289      275      -14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

They have been moved one level up to the InMemoryTorrentRepository type.

We should buble them up to the final user, returing an error in the UDP
or HTTP tracker when the swarm handle lock cannot be adquired.

A new issues will be opened to address that.
It was public only to allow setting a pre-defined state in tests.

A new public method have been adding temporarily to explain its usage.
@josecelano
Copy link
Member Author

ACK 4d91738

@josecelano josecelano marked this pull request as ready for review May 7, 2025 11:59
@josecelano josecelano merged commit ec3cac9 into torrust:develop May 7, 2025
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Code Cleanup / Refactoring Tidying and Making Neat

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Overhaul stats: Improve torrent-repository package before adding events

1 participant