-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
sparse registry: determine UX and URL handling #10964
Comments
So my opinion is that we should not recommend that registries plan to have two indexes with the same content in the long run. crates.io is going to do that, but it's a pretty large maintenance burden and I don't think it's worth it for anyone else. New registries should be built with sparse indexes, and just not support older Cargos. So the question is what to do with existing registries that want to transition from git indexes to sparse indexes? What should they serve wear and for how long? If they're using an existing registry as a source replacement for crates.io, then their source URL does not appear in any files. If they have any private packages not yet on crates.io this use pattern is not recommended by our documentation, but I believe it's quite common. These registries can provide the same files at both a git and sparse url for some transition period. Nothing changes depending on whether the user has git or sparse urls configured. Once no one is using the git, it can be shut down. This is as easy a migration as anyone could ask for. But what if the existing registry is not intended to be used as a source replacement for crates.io? Then if custom package If the organization mostly builds recent versions of its software. Then have both registries and treat them as different. New packages/versions are published to the sparse registry at If the organization needs to regularly build historical versions of its software, but really wants to transition to sparse indexes... I don't have a real solution, but I'm also doubtful there are that many users in this category. |
Yes, that is the problem I was describing. Cargo considers the registry URL to be part of the package identity and includes that information in the Here's an example of what's included in the
|
To follow up on this, the current proposal is available here: https://hackmd.io/@rust-cargo-team/B13O52Zko We plan to provide the In the future (some unspecified time), we may proceed with the second part of the proposal to add a The New registry and Without compatibility options will be available to alt-registries from the start. But obviously that option is not convenient. |
This is an open-ended issue about ultimately determining the UX for how users opt-in to sparse registries, and how that interacts with URLs, Package IDs, Cargo.lock files, config files, etc.
The approach may differ from crates.io compared to third-party registries. However, I think it would be good to think about them together so that there is a coherent story.
Cargo.lock
files andCargo.toml
in.crate
files for alt-registries. What is the migration story for alt-registries that want to support sparse registries? What if they want to offer both git and sparse at the same time?Some roughly thought-out proposals:
Proposal 1 — Alt-registry config
Add a new
registry.*.sparse
key which is the URL for a sparse index. Allow bothindex
andsparse
to be specified at the same time. Cargo will use theindex
URL inCargo.lock
and will generally treat the two URLs as interchangeable.If only
sparse
is listed, then Cargo will only use the sparse index, and the sparse URL will be used inCargo.lock
and PackageIDs and publishedCargo.toml
files (alt-registries).Proposal 2 — Easy toggle
Add a "preferred" setting which indicates the preferred mechanism for speaking to a registry. It might look something like this:
Via environment variables, this would look like
CARGO_REGISTRIES_CRATES_IO_PREFERRED=sparse
.(Bikeshed name welcome.)
This setting can be used for crates.io or any other registry.
Proposal 3 — Source replacement
This option works today (AFAIK), but is a little clumsy.
Proposal 4 — Migration story
An organization using an alt registry may want to transition to using sparse indexes. There are a few options:
Cargo.lock
and.crate
files.Cargo.lock
files to use the new URL, and rebuild all.crate
files to the new URL. (This sounds almost too painful to suggest.)Proposal 5 — New registries
New registries may want to only support sparse indexes. In that case, they should have a simple config:
or a different idea would be:
All URLs in
Cargo.lock
and other places will use the sparse URL.The text was updated successfully, but these errors were encountered: