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

feat: split wws code in multiple crates #106

Merged
merged 5 commits into from
Mar 15, 2023
Merged

Conversation

Angelmmiguel
Copy link
Contributor

@Angelmmiguel Angelmmiguel commented Mar 9, 2023

The purpose of this PR is to split the current project into separate crates. Currently, all the code is split in modules inside the ./src folder. This is causing some issues:

  • When importing wws as a library, it needs to compile the entire project. This includes clap and other libraries that are only related to the wws CLI
  • Some parts of the code have cyclic dependencies (X relies on Y and the opposite). This is difficult to spot when all the code is in the same crate. By splitting it into multiple crates, we define a clear responsibility and API for the different crates
  • Applying changes and fixes to specific crates is simpler to do it on the entire project
  • We can use the Cargo workspace tooling to manage and share dependencies easily

Now it's a great moment to perfrom these changes as we just released a new version and we're planning to start using wws as a library.

For now, I identified these crates:

  • config: manage the wws global configuration (.wws.toml file)
  • data-kv: manage the KV in-memory store we ship with wws
  • router: define the routes by loading files from the local filesystem. It also initializes the workers
  • runtimes: initalize and configure wasmtime to run workers' source code.
  • runtimes-manager: interacts with the remote repository to install and uninstall language runtimes (ruby, python, etc)
  • server: run the final HTTP server users can query
  • store: manage the temporary store for the runtime and worker files / folders
  • worker: initialize all the required resources to run a worker from the given file. It also calls the runtime to return a response

It closes #102

@Angelmmiguel Angelmmiguel added the 🚀 enhancement New feature or request label Mar 9, 2023
@Angelmmiguel Angelmmiguel added this to the v1.1.0 milestone Mar 9, 2023
@Angelmmiguel Angelmmiguel self-assigned this Mar 9, 2023
@Angelmmiguel Angelmmiguel requested a review from a team March 15, 2023 09:14
@Angelmmiguel Angelmmiguel marked this pull request as ready for review March 15, 2023 09:14
Copy link
Contributor

@ereslibre ereslibre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Angelmmiguel! It's awesome to see how this code evolves.

crates/config/src/lib.rs Outdated Show resolved Hide resolved
crates/data-kv/src/lib.rs Outdated Show resolved Hide resolved
crates/runtimes-manager/src/lib.rs Show resolved Hide resolved
crates/runtimes-manager/src/metadata.rs Show resolved Hide resolved
crates/server/src/handlers/worker.rs Show resolved Hide resolved
crates/server/src/handlers/worker.rs Show resolved Hide resolved
crates/server/src/handlers/worker.rs Show resolved Hide resolved
crates/server/src/lib.rs Show resolved Hide resolved
crates/server/src/lib.rs Show resolved Hide resolved
crates/server/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@ereslibre ereslibre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 🚢 it!

@Angelmmiguel Angelmmiguel merged commit 04ea3ef into main Mar 15, 2023
@Angelmmiguel Angelmmiguel deleted the 102-split-code-in-crates branch May 8, 2023 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split the project codebase in multiple crates to simplify development and consumption
3 participants