-
Notifications
You must be signed in to change notification settings - Fork 54
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
Split codebase into a workspace of multiple library crates #46
Conversation
while you're looking at the 'librification' of Alexandrie, you might like to consider adopting A little about my motivation here
To meet those goals, i'm trying to both
To be honest i don't really mind which works out first, or if they meet in the middle! |
Adopting About the |
501e8b4
to
0b4cc36
Compare
I think we can move forward with this initial library split, keeping it in a PR would require doing rebases each time we make a change on |
This PR factors out some modules of the
alexandrie
binary crate into their own library crates and transforms the project into a workspace in the process.Here is a description of what the different crates are:
alexandrie
:No change here, this is the main binary crate just as before, but it now makes use of the other libraries in the workspace.
alexandrie-index
:This crate contains the definitions of the
Indexer
trait and all of its implementors (currentlyCommandLineIndex
andGit2Index
).It also contains the relevant configuration structs for all of these types.
alexandrie-storage
:This crate contains the definitions of the
Store
trait and all of its implementors (currently onlyDiskStorage
).Similarly, it also contains the relevant configuration structs for these types.
alexandrie-rendering
:This crate contains everything needed to perform Markdown rendering (including the syntax-highlighting of the code blocks).
It also contains all the
syntect
-related configuration bits (like reading dumps or traversing directory trees to load syntax and theme definitions).We'll most-likely split the binary crate even more, in the future, to separate even more concerns and/or expose some more of the registry's mechanisms to any developer.
The motivations for this is:
Having multiple crates in the project splits concerns, even at the dependency management level, so each library have its own dependencies that the main binary crate doesn't need to have.
And Cargo makes managing these multiple crates super easy, all the previous commands like
cargo build
orcargo update
just works across the workspace.With separate crates, we can better write integration tests for each part of the system (the index management part, the crate storage part, the README rendering part, etc...).
With this change, other codebases have access to the same types that the registry uses, therefore, we can, for instance, more easily build companion tools, like a health-checking tool for the registry (a binary that could check that the crate index, the database and the crate storage are all in-sync) or the README rendering tool we're currently working on (Companion tool to manage renderings of READMEs #45).