Refactor: reorganize modules#246
Merged
josecelano merged 12 commits intotorrust:developfrom Mar 17, 2023
Merged
Conversation
Move apps into a "servers" module.
d17d0ad to
46f4900
Compare
Database is only use inisde the `tracker` mod.
f5433f7 to
d25cbd5
Compare
1b3ef25 to
69a09d7
Compare
`protocol` nod contains logic not only for BitTorrent protocol.
69a09d7 to
9ffcd6b
Compare
46853b4 to
2d99866
Compare
4bdcffc to
fcce9f8
Compare
To follow production code conventions.
fcce9f8 to
cbca065
Compare
There was a lot of duplicate code for app initialization between prod and testing code.
Member
Author
|
The final folder structure: $ tree -L 5 src/
src/
├── app.rs
├── bootstrap
│ ├── app.rs
│ ├── jobs
│ │ ├── http_tracker.rs
│ │ ├── mod.rs
│ │ ├── torrent_cleanup.rs
│ │ ├── tracker_apis.rs
│ │ └── udp_tracker.rs
│ ├── logging.rs
│ └── mod.rs
├── lib.rs
├── main.rs
├── servers
│ ├── apis
│ │ ├── mod.rs
│ │ ├── routes.rs
│ │ ├── server.rs
│ │ └── v1
│ │ ├── context
│ │ │ ├── auth_key
│ │ │ ├── mod.rs
│ │ │ ├── stats
│ │ │ ├── torrent
│ │ │ └── whitelist
│ │ ├── middlewares
│ │ │ ├── auth.rs
│ │ │ └── mod.rs
│ │ ├── mod.rs
│ │ ├── responses.rs
│ │ └── routes.rs
│ ├── http
│ │ ├── mod.rs
│ │ ├── percent_encoding.rs
│ │ ├── server.rs
│ │ └── v1
│ │ ├── extractors
│ │ │ ├── announce_request.rs
│ │ │ ├── authentication_key.rs
│ │ │ ├── client_ip_sources.rs
│ │ │ ├── mod.rs
│ │ │ └── scrape_request.rs
│ │ ├── handlers
│ │ │ ├── announce.rs
│ │ │ ├── common
│ │ │ ├── mod.rs
│ │ │ └── scrape.rs
│ │ ├── launcher.rs
│ │ ├── mod.rs
│ │ ├── query.rs
│ │ ├── requests
│ │ │ ├── announce.rs
│ │ │ ├── mod.rs
│ │ │ └── scrape.rs
│ │ ├── responses
│ │ │ ├── announce.rs
│ │ │ ├── error.rs
│ │ │ ├── mod.rs
│ │ │ └── scrape.rs
│ │ ├── routes.rs
│ │ └── services
│ │ ├── announce.rs
│ │ ├── mod.rs
│ │ ├── peer_ip_resolver.rs
│ │ └── scrape.rs
│ ├── mod.rs
│ ├── signals.rs
│ └── udp
│ ├── connection_cookie.rs
│ ├── error.rs
│ ├── handlers.rs
│ ├── mod.rs
│ ├── peer_builder.rs
│ ├── request.rs
│ └── server.rs
├── shared
│ ├── bit_torrent
│ │ ├── common.rs
│ │ ├── info_hash.rs
│ │ └── mod.rs
│ ├── clock
│ │ ├── mod.rs
│ │ ├── static_time.rs
│ │ ├── time_extent.rs
│ │ └── utils.rs
│ ├── crypto
│ │ ├── ephemeral_instance_keys.rs
│ │ ├── keys.rs
│ │ └── mod.rs
│ └── mod.rs
└── tracker
├── auth.rs
├── databases
│ ├── driver.rs
│ ├── error.rs
│ ├── mod.rs
│ ├── mysql.rs
│ └── sqlite.rs
├── error.rs
├── mod.rs
├── peer.rs
├── services
│ ├── mod.rs
│ ├── statistics
│ │ ├── mod.rs
│ │ └── setup.rs
│ └── torrent.rs
├── statistics.rs
└── torrent.rs
28 directories, 81 files
The previous folder structure: $ tree -L 4 src/
src/
├── apis
│ ├── mod.rs
│ ├── routes.rs
│ ├── server.rs
│ └── v1
│ ├── context
│ │ ├── auth_key
│ │ ├── mod.rs
│ │ ├── stats
│ │ ├── torrent
│ │ └── whitelist
│ ├── middlewares
│ │ ├── auth.rs
│ │ └── mod.rs
│ ├── mod.rs
│ ├── responses.rs
│ └── routes.rs
├── databases
│ ├── driver.rs
│ ├── error.rs
│ ├── mod.rs
│ ├── mysql.rs
│ └── sqlite.rs
├── http
│ ├── mod.rs
│ ├── percent_encoding.rs
│ ├── server.rs
│ └── v1
│ ├── extractors
│ │ ├── announce_request.rs
│ │ ├── authentication_key.rs
│ │ ├── client_ip_sources.rs
│ │ ├── mod.rs
│ │ └── scrape_request.rs
│ ├── handlers
│ │ ├── announce.rs
│ │ ├── common
│ │ ├── mod.rs
│ │ └── scrape.rs
│ ├── launcher.rs
│ ├── mod.rs
│ ├── query.rs
│ ├── requests
│ │ ├── announce.rs
│ │ ├── mod.rs
│ │ └── scrape.rs
│ ├── responses
│ │ ├── announce.rs
│ │ ├── error.rs
│ │ ├── mod.rs
│ │ └── scrape.rs
│ ├── routes.rs
│ └── services
│ ├── announce.rs
│ ├── mod.rs
│ ├── peer_ip_resolver.rs
│ └── scrape.rs
├── jobs
│ ├── http_tracker.rs
│ ├── mod.rs
│ ├── torrent_cleanup.rs
│ ├── tracker_apis.rs
│ └── udp_tracker.rs
├── lib.rs
├── logging.rs
├── main.rs
├── protocol
│ ├── clock
│ │ ├── mod.rs
│ │ └── time_extent.rs
│ ├── common.rs
│ ├── crypto.rs
│ ├── info_hash.rs
│ ├── mod.rs
│ └── utils.rs
├── setup.rs
├── signals.rs
├── stats.rs
├── tracker
│ ├── auth.rs
│ ├── error.rs
│ ├── mod.rs
│ ├── peer.rs
│ ├── services
│ │ ├── common.rs
│ │ ├── mod.rs
│ │ ├── statistics.rs
│ │ └── torrent.rs
│ ├── statistics.rs
│ └── torrent.rs
└── udp
├── connection_cookie.rs
├── error.rs
├── handlers.rs
├── mod.rs
├── peer_builder.rs
├── request.rs
└── server.rs
23 directories, 75 filesI think we still have to improve many things, for example, the tracker mod. I would add folders like:
but we can do it when we start extracting the packages or if the complexity increases. |
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.
I'm going to start working on the built-in crate documentation. A crucial point to understanding a code base is the folder/mod structure. If you want a good structure for the documentation, the docs have to mirror the code, and we cannot have good documentation without having a good folder structure.
I have also removed duplicated code for the application initialization. The code was duplicated for testing.