-
Notifications
You must be signed in to change notification settings - Fork 43
[1/n] [nexus-db-queries] move LookupPath to another crate #7985
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
Merged
sunshowers
merged 8 commits into
main
from
sunshowers/spr/nexus-db-queries-move-lookuppath-to-another-crate
Apr 18, 2025
Merged
[1/n] [nexus-db-queries] move LookupPath to another crate #7985
sunshowers
merged 8 commits into
main
from
sunshowers/spr/nexus-db-queries-move-lookuppath-to-another-crate
Apr 18, 2025
Conversation
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
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
smklein
approved these changes
Apr 18, 2025
|
||
//! Integration tests for nexus-db-lookup. | ||
//! | ||
//! Note: all integration tests for a crate live in a single binary for build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's only one integration test here, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but if we add more I wanted to guide folks to putting them within this binary :)
Created using spr 1.3.6-beta.1
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.
Introduce
nexus-db-lookup
, a new crate that containsLookupPath
and all of the corresponding resources.This change has two advantages:
While attempting to split some of omicron-nexus up into multiple crates that could potentially compile in parallel with nexus-db-queries, I ran into the issue that
LookupPath
, which is a fairly fundamental type, lived inside nexus-db-queries.This is an okay build speed improvement in its own right. With this change,
touch nexus-db-queries/src/lib.rs && cargo check -p nexus-db-queries
goes from around 2.45 seconds to 2.15 seconds (around 1.15x faster).That's because the
lookup_resource
macros in the new nexus-db-lookup crate expand to quite a lot of code: around 15k lines or so compared to the rest of nexus-db-queries' 75k lines when expanded.In order to achieve this goal:
DataStore
implements. That isn't too bad, though. I'm not totally sure this will end up being the final shape of such an interface, but it works for now and can be changed later with minimal disruption.This PR aims to minimize ugliness at callsites (i.e.
nexus.datastore()
rather than&**nexus.datastore()
). However I did let some churn through, specifically places where we passed in immediately-dereferenced types like&&DataStore
.