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

Add support for sparse index by serving registry over HTTP as static file #49

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Conversation

fMeow
Copy link
Collaborator

@fMeow fMeow commented Jun 22, 2022

Serving registry over HTTP as static file is a feature described in rust-lang/rfcs#2789, and the implementation rust-lang/cargo#10470 is already merged in cargo currently as unstable feature http-registry.

This PR add support for http-registry by serving index files over HTTP, and ignored hidden file to avoid leaking .git folder.

  1. add sparse_index_config in config to control HTTP registry path
    [sparse_index_config]
    path = "api/v1/crates"
  2. add feature gate sparse-index to enable http registry endpoint

@fMeow fMeow closed this by deleting the head repository Sep 3, 2022
@fMeow fMeow reopened this Sep 3, 2022
@gagbo
Copy link
Collaborator

gagbo commented Feb 12, 2023

Were you able to test this?

Sorry for coming back to this only now. It seems the feature has been renamed sparse-registry and I'll try to review this.

Basically my main issue is that I don't know where to look for the actual expected format of the registry

Copy link
Collaborator

@gagbo gagbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems fine as is, just one small question:

Does the current implementation enforces that the same path is used in the HTTP route, and in the local folder on the filesystem? It feels like it creates a lot of friction (especially if there are changes in the unstable feature on Cargo-side)

@@ -9,6 +9,7 @@ mod index_manager;
mod models;
mod post;
mod put;
mod sparse;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick (and I don't know if it's consistently applied in this codebase), but I'd rather have the cfg attribute here than in the sparse.rs file.

This way I know directly from the main file whether the module is relevant or not

Suggested change
mod sparse;
#[cfg(feature = "sparse-index")]
mod sparse;

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.

None yet

2 participants