Skip to content

Commit

Permalink
Update RFC 2141
Browse files Browse the repository at this point in the history
This fixes a couple of typos, as well as changing the index
specification to store registry names rather than index URLs. It also
adds the `name` field to `config.json` to identify the canonical name of
a registry.
  • Loading branch information
sfackler committed Jan 17, 2018
1 parent c892139 commit 4c6d512
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions text/2141-alternative-registries.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ In order to tell Cargo about a registry other than crates.io, you can specify an

```toml
[registries]
choose-a-name = "https://my-intranet:8080/index"
my-registry = "https://my-intranet:8080/index"
```

Instead of `choose-a-name`, place the name you'd like to use to refer to this registry in your
`Cargo.toml` files. The URL specified should contain the location of the registry index for this
registry; the registry format is specified in the [Registry Index Format Specification
section][registry-index-format-specification].
Every registry has a name, specified in the `config.json` file in its index. The name specified
must match the registry's configured name. The URL specified should contain the location of the
registry index for this registry; the registry format is specified in the
[Registry Index Format Specification section][registry-index-format-specification].

Alternatively, you can specify each registry as follows:

```toml
[registries.choose-a-name]
[registries.my-registry]
index = "https://my-intranet:8080/index"
```

Expand Down Expand Up @@ -182,14 +182,18 @@ A valid registry index meets the following criteria:

```json
{
"dl": "https://my-crates-server.com/api/v1/crates",
"name": "my-registry",
"dl": "https://my-crates-server.com/api/v1/crates/{crate}/{version}/download",
"api": "https://my-crates-server.com/",
"allowed-registries": ["https://github.com/rust-lang/crates.io-index", "https://my-intranet:8080/index"]
"allowed-registries": ["crates.io", "my-other-registry"]
}
```

The `dl` key is required specifies where Cargo can download the tarballs containing the source
files of the crates listed in the registry.
The `name` key is required and specifies the name of this registry.

The `dl` key is required and specifies where Cargo can download the tarballs containing the source
files of the crates listed in the registry. It is templated by the strings `{crate}` and
`{version}` which are replaced with the name and version of the crate to download, respectively.

The `api` key is optional and specifies where Cargo can find the API server that provides the
same API functionality that crates.io does today, such as publishing and searching. Without the
Expand All @@ -200,12 +204,14 @@ A valid registry index meets the following criteria:
index are allowed to have dependencies on. The default will be nothing, which will mean only
crates that depend on other crates in the current registry are allowed. This is currently the
case for crates.io and will remain the case for crates.io going forward. Alternate registries
will probably want to add crates.io to this list.
will probably want to add `crates.io` to this list.

- There will be a number of directories in the git repository.
- `1/` - holds files for all crates whose names have one letter.
- `2/` - holds files for all crates whose names have two letters.
- `3/` - holds files for all crates whose names have three letters.
- `3/a` etc - for all crates whose names have three letters, their files will
be in a directory named `3`, then a subdirectory named with the first letter
of their name.
- `aa/aa/` etc - for all crates whose names have four or more letters, their
files will be in a directory named with the first and second letters of
their name, then in a subdirectory named with the third and fourth letters
Expand All @@ -226,7 +232,7 @@ A valid registry index meets the following criteria:
{
"name": "serde",
"req": "^1.0",
"registry": "https://github.com/rust-lang/crates.io-index",
"registry": "crates.io",
"features": [],
"optional": true,
"default_features": true,
Expand Down

0 comments on commit 4c6d512

Please sign in to comment.