cargo icon indicating copy to clipboard operation
cargo copied to clipboard

sparse registry: transition plan for index.crates.io as default

Open ehuss opened this issue 1 year ago • 2 comments

This is an open-ended issue to explore what will be necessary to make index.crates.io the default for accessing the crates.io index.

One concern about flipping the switch is that many users may not be prepared to be able to communicate to index.crates.io. They may have firewall rules or other restrictions that limit them to communicating with github.com that may not be easy to change. If we flip the switch, I think we should try to accommodate them as best as possible. Some options:

  • Provide an easy config to use one index or the other.
  • Provide a clumsy config to use one index or the other (using source-replacement).
  • Auto-detect if Cargo cannot communicate to index.crates.io, and fall back to github.com.

Automatic fallback

My guess is that the automatic fallback will be somewhat difficult to implement. However, I would like to explore to see if it is possible or desirable. Cargo could treat a limited subset of errors trying to contact index.crates.io as an indication that it should switch to github. However, that seems risky since any transient error could cause cargo to download the index from github which we want to avoid. Is this even feasible?

ehuss avatar Aug 10 '22 01:08 ehuss

One concern about flipping the switch is that many users may not be prepared to be able to communicate to index.crates.io.

This seems unlikely to me, or at least easy to fix. These users already need to be able to access static.crates.io in order to download the crate.

Cargo could treat a limited subset of errors trying to contact index.crates.io as an indication that it should switch to github.

This may require network and hardware level time out to realize the connection won't work. I don't think a dynamic fullback will provide a good user experience. However if there is a config then we can suggesting it in the error message when we think index.crates.io is blocked.

Eh2406 avatar Aug 15 '22 00:08 Eh2406

To follow up on this, the current proposal is available here: https://hackmd.io/@rust-cargo-team/B13O52Zko

We plan to provide the registries.crates-io.protocol config setting to provide a mechanism to switch between git and http for crates.io only.

We do not plan to have any sort of auto-detection or fallback at this time. I think once we have broader experience, we can reevaluate how important that is.

ehuss avatar Aug 31 '22 19:08 ehuss