cloudflare / pingora

A library for building fast, reliable and evolvable network services.
Apache License 2.0
20.35k stars 1.1k forks source link

Suggestion for Simplifying Module Organization #92

Open gengteng opened 4 months ago

gengteng commented 4 months ago

Hello,

While exploring the source code of the pingora project, I noticed that the organization of modules often involves the use of a directory with a single mod.rs file for many modules. This approach, although functional, seems somewhat unnecessary when a module does not have submodules. A simpler and more streamlined method would be to use a single file named after the module (xxx.rs) instead of creating a directory with a mod.rs file for modules without submodules.

Adopting this strategy can offer several benefits:

I understand that this change would require a significant effort to reorganize existing code, and I appreciate the work that has already gone into developing pingora. However, I believe that this simplification could improve the project's overall maintainability and accessibility.

Would you be open to considering this suggestion for the future development of pingora? I am willing to assist in this transition if my proposal is accepted.

Thank you for your time and for your contributions to the open-source community. I look forward to your thoughts on this suggestion.

johnhurt commented 4 months ago

Thank you for the suggestion and especially for your willingness to help. I think you are right that replacing a lonely blah/mod.rs with blah.rs would improve approachability. I don't think this is a change we will pursue internally, but if you feel strongly, we would welcome some (more 😉 ) of your prs to get it done. Since this is such a big change (from git's point of view), I would recommend making the switch in small batches to help avoid merge conflicts. We are working internally on pingora every day and only releasing changes about once a week. Thanks again!