Skip to content

Tracking Issue for serving an index over HTTP #9069

@ehuss

Description

@ehuss
Contributor

Summary

RFC: #2789
Implementation: #10470
Documentation: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#sparse-registry
Issues: A-sparse-registry Area: http sparse registries

This is a tracking issue for RFC #2789, an experimental extension to serve the index over HTTP instead of via git.

Unresolved issues

Current best way to test

To try it out, add the -Z sparse-registry flag on nightly-2022-06-20 or newer build
of Cargo. For example, to update dependencies:

rustup update nightly
cargo +nightly -Z sparse-registry update

The feature can also be enabled by setting the environment variable
CARGO_UNSTABLE_SPARSE_REGISTRY=true. Setting this variable will have no effect on stable
Cargo, making it easy to opt-in for CI jobs.

If you see any issues please report them in new tickets here in the Cargo repo. The output of Cargo
with the environment variable CARGO_LOG=cargo::sources::registry::http_remote=trace set
will be helpful in debugging.

About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

Implementation history

Activity

changed the title [-]Tracking Issue for servering an index over HTTP[/-] [+]Tracking Issue for serving an index over HTTP[/+] on Feb 13, 2022
mightyiam

mightyiam commented on Jun 22, 2022

@mightyiam

Hey, would this mean that when cargo publish exits with 0 the published crate version is actually available (which is not the case now, due to CDN)?

kornelski

kornelski commented on Jun 22, 2022

@kornelski
Contributor

It doesn't address this problem. There is still going to be a delay between cargo publish and the crate being available globally. It would be nice to improve this, but it's more of an issue for server-side crates-io implementation than the registry protocol.

epage

epage commented on Jun 22, 2022

@epage
Contributor

@mightyiam #9507 is the issue you want to be following.

For background, publishing a crate used to be a blocking operation but to speed up crates.io, they made cargo publish just put the crate into a queue for later publishing, making the operation asynchronous.

Tools like cargo-release poll the server. We could easily do similar in cargo until an improved registry protocol is made. I was looking at implementing it but there was a large hurdle for writing the relevant tests. The new sparse registry code has improved the test infrastructure so I could now write the relevant tests.

40 remaining items

Christoph-AK

Christoph-AK commented on Mar 23, 2023

@Christoph-AK

I'm super glad this got merged, but I am having trouble finding the necessary config steps to enable the new behaviour.
Most of the documentation, like in the first post in this issue, still mention it as unstable feature to be enabled with -Z.
Adding [registries.crates-io] protocol = sparse to my cargo.toml doesn't work, i suppose it needs to be added to some cargo config file somewhere else.
Could someone that got it running write some annotations or documentation in some easy to find places?

JockeTF

JockeTF commented on Mar 23, 2023

@JockeTF

Cargo.toml doesn't work

Agreed, this is a great feature! According to the release notes you're supposed to add the setting to .cargo/config.toml, not Cargo.toml. Either that, or set the environment variable CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse. The release notes have some links to more information as well!

added a commit that references this issue on May 4, 2023
jose-mut-lopez

jose-mut-lopez commented on Jun 19, 2023

@jose-mut-lopez

you're supposed to add the setting to .cargo/config.toml, not Cargo.toml.

thanks for this and those links, but for future outsider readers like me, it looks like this became the default in cargo 1.70 which was released on June 2023 (https://blog.rust-lang.org/2023/06/01/Rust-1.70.0.html#sparse-by-default-for-cratesio), so a better approach now IMO is just to rustup update, which will use the fast index on all repos by default without any per-repo config.

moved this to Done in Cargo Roadmapon Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-sparse-registryArea: http sparse registriesC-tracking-issueCategory: A tracking issue for something unstable.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ehuss@epage@kornelski@Nemo157@lnicola

        Issue actions