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

Lazy index loading (1/2) #1085

Merged
merged 4 commits into from
Jul 20, 2022
Merged

Lazy index loading (1/2) #1085

merged 4 commits into from
Jul 20, 2022

Conversation

mosteo
Copy link
Member

@mosteo mosteo commented Jul 9, 2022

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 -> provided mappings 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

@mosteo mosteo marked this pull request as ready for review July 10, 2022 09:53
@Fabien-Chouteau
Copy link
Member

Fabien-Chouteau commented Jul 18, 2022

new metadata file that is invalidated whenever indexes are added or updated

What if I add a new crate in my local index? Will this be detected?

(I didn't look at the PR content yet)

@mosteo
Copy link
Member Author

mosteo commented Jul 19, 2022

What if I add a new crate in my local index? Will this be detected?

You're right, this won't be detected, although running alr index --update-all is all it takes to fix it. I don't see any simple way of detecting this that doesn't involve complex filesystem monitoring.

I will add a note about it in the publishing documentation.

@mosteo mosteo merged commit d645482 into master Jul 20, 2022
@mosteo mosteo deleted the feat/lazy-load-1 branch July 20, 2022 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alire checks manifest files of all releases in index for no reason Load index on demand
3 participants