Lazy index loading (1/2)#1085
Merged
Merged
Conversation
Member
What if I add a new crate in my local index? Will this be detected? (I didn't look at the PR content yet) |
Fabien-Chouteau
approved these changes
Jul 18, 2022
Member
Author
You're right, this won't be detected, although running I will add a note about it in the publishing documentation. |
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.
This is the first of two PRs that remove the need to load the full index for many operations.
The idea is that we know what indexes are configured, where they are on disk, and where each crate lives therein, so any time a crate is needed, we can load it at that time. All in all, this should speed-up things when indexes grow, and fewer external detections should be attempted.
There is a catch that makes this not as straightforward as it seems, which is that "provides" fields mean that a provided crate may require loading whichever other crates provide it, and this is unknown in advance until the whole index has been loaded at least once.
This part is what goes into the follow-up PR: the first time we "see" an index, it is loaded in full and
provider -> providedmappings are stored in a new metadata file that is invalidated whenever indexes are added or updated. From then on, we know all the crates that must be loaded when one is requested, and lazy load works as intended in all cases.Fixes #910, fixes #381