Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul core Tracker: extract torrents context (part 1) #1201

Closed
Tracked by #1181
josecelano opened this issue Jan 22, 2025 · 0 comments · Fixed by #1202
Closed
Tracked by #1181

Overhaul core Tracker: extract torrents context (part 1) #1201

josecelano opened this issue Jan 22, 2025 · 0 comments · Fixed by #1202
Assignees
Labels
Code Cleanup / Refactoring Tidying and Making Neat

Comments

@josecelano
Copy link
Member

josecelano commented Jan 22, 2025

Parent issue: #1181

Remove field torrents from core::Tracker extracting new services for each responsibility:

  • InMemoryTorrentRepository: all the info about torrents in memory.
  • DatabasePersistentTorrentRepository: the torrent's data that is persisted (only number of downloads)
  • TorrentsManager: other tasks like load torrents' data from database, ...
  • ... there could be other services after the refactor.
@josecelano josecelano mentioned this issue Jan 22, 2025
26 tasks
@josecelano josecelano self-assigned this Jan 22, 2025
@josecelano josecelano added the Code Cleanup / Refactoring Tidying and Making Neat label Jan 22, 2025
@josecelano josecelano linked a pull request Jan 23, 2025 that will close this issue
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 23, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 23, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 23, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 23, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 23, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 23, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 23, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 23, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 23, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 23, 2025
@josecelano josecelano linked a pull request Jan 23, 2025 that will close this issue
@josecelano josecelano changed the title Overhaul core Tracker: extract torrents context Overhaul core Tracker: extract torrents context (part 1) Jan 23, 2025
josecelano added a commit that referenced this issue Jan 23, 2025
612f729 refactor: [#1201] remove tracker dependency on TorrentsManager (Jose Celano)
3a2e8f0 refactor: [#1201] reorganize methods in tracker (Jose Celano)
b3fcdb4 refactor: [#1201] remove direct dependency on database from tracker (Jose Celano)
bdc3f22 refactor: [#1201] add database to app container y environments (Jose Celano)
a4a2d67 refactor: [#1201] remove pub fn from tracker (Jose Celano)
6fb632e refactor: [#1201] remove duplicate code (Jose Celano)
4e3dbae refactor: [#1201] inject new extracted sercvies in core tracker (Jose Celano)
6332261 refactor: [#1201] extract TorrentsManager (Jose Celano)
f4dcb51 refactor: [#1201] rename tracker field (Jose Celano)
9b5f776 refactor: [#1201] exatrct DatabasePersistentTorrentRepository (Jose Celano)
03ef7f6 refactor: [1201] extract InMemoryTorrentRepository (Jose Celano)

Pull request description:

  Overhaul core Tracker: extract torrents context.

  This PR is part of the implementation of the issue: #1201.

  The core Tracker is getting smaller and smaller. This PR reduces the dependencies to:

  ```rust
  pub struct Tracker {
      /// The tracker configuration.
      config: Core,

      /// The service to check is a torrent is whitelisted.
      pub whitelist_authorization: Arc<whitelist::authorization::Authorization>,

      /// The in-memory torrents repository.
      in_memory_torrent_repository: Arc<InMemoryTorrentRepository>,

      /// The persistent torrents repository.
      db_torrent_repository: Arc<DatabasePersistentTorrentRepository>,
  }
  ```

  I will open a new PR (part 2) to continue extracting the rest of methods that are not used directly in a `announce` or `scrape` requests.

ACKs for top commit:
  josecelano:
    ACK 612f729

Tree-SHA512: 3ac17b515e9c521c128cd3694724d9f5294a1ea8a0b123959953d48d20556efec1de8e105c297bf1e75d1164b91fe4805c970a223572edc8ece9de2d020ce7d6
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 a pull request may close this issue.

1 participant