Skip to content

Lazy index loading (1/2)#1085

Merged
mosteo merged 4 commits into
masterfrom
feat/lazy-load-1
Jul 20, 2022
Merged

Lazy index loading (1/2)#1085
mosteo merged 4 commits into
masterfrom
feat/lazy-load-1

Conversation

@mosteo

@mosteo mosteo commented Jul 9, 2022

Copy link
Copy Markdown
Member

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
@mosteo mosteo requested a review from Fabien-Chouteau July 10, 2022 09:53
@Fabien-Chouteau

Fabien-Chouteau commented Jul 18, 2022

Copy link
Copy Markdown
Member

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

mosteo commented Jul 19, 2022

Copy link
Copy Markdown
Member Author

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