Skip to content

Commit 0e4c0e6

Browse files
committed
ext: pull in Sajay and Stephen's iteration on extensions
Signed-off-by: Vincent Batts <[email protected]> Signed-off-by: Vincent Batts <[email protected]>
1 parent b501a83 commit 0e4c0e6

File tree

3 files changed

+108
-37
lines changed

3 files changed

+108
-37
lines changed

ext/README.md

Lines changed: 52 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,74 @@
1-
# Extensions
1+
---
2+
tags: oci,distribution
3+
breaks: false
4+
---
25

3-
The basis of the Extension API is described in a document which should be emulated for all extensions.
6+
# Extensions API for Distribution
47

5-
## Table of Contents
6-
7-
<!-- toc -->
8-
* [Table](#table)
9-
* [Name](#name)
10-
* [Filename](#filename)
11-
* [Detail](#detail)
12-
* [Prior Art](#prior-art)
13-
<!-- /toc -->
8+
The basis of the Extension API is described in a document which should
9+
be emulated for all extensions.
1410

1511
## Table
1612

1713
_notice_: All new `./ext/ext-$name.md` docs MUST be added to this table.
1814

19-
| `$name` (and definition) | Summary |
20-
|:--:|:--:|
21-
| [0](./ext-0.md) | Extensions discovering extensions on registry server |
22-
| | |
23-
15+
| `$name` | Summary |
16+
|:------------------------:|:----------------------------------------------------:|
17+
| [ext](./ext.md) | Extensions discovering extensions on registry server |
2418

2519
## Name
2620

27-
Extension names MUST be unique.
28-
Names SHOULD include a version.
21+
Extension names MUST be unique. Extensions are specified by
22+
`namespace` aligning with the project, followed by the `extension` provided by the project and last by by the `component`. This constitues the URI segments
23+
of the extension endpoint. Additional options may be passed as parameters to the endpoint.
24+
25+
```http
26+
_<ns>/<ext>/<component>[?<key>=<value>&...]
27+
```
28+
29+
For versioning, extensions SHOULD use versioned `mediaType`.
30+
31+
### Registry Level Extensions
2932

30-
Each extension's endpoints will be nested below its name.
33+
Registry level extensions are nested under `/v2`.
3134

32-
```HTTP
33-
GET /v2/ext/0/...
35+
```http
36+
GET /v2/_<ns>/<ext>/<component>[?<key>=<value>&...]
37+
```
38+
39+
For example a search extension may be of the form `/v2/_oci/catalog/search?pattern=foo?n=10`
40+
41+
### Repository Level Extensions
42+
43+
Repository level extensions follow the same naming rules the endpoints
44+
can be access under a repository.
45+
46+
```http
47+
GET /v2/<name>/_<ns>/<ext>/<component>[?<key>=<value>&...]
3448
```
3549

3650
## Filename
3751

38-
XXX
52+
Extention definitions SHOULD be placed under `./ext/`. Extension files
53+
SHOULD follow the `ext-$name.md`. Refer [ext.md](./ext.md) for more details.
3954

4055
## Detail
4156

42-
XXX acceptable error codes
57+
Extensions details MAY describe more endpoints and APIs that it MAY support.
58+
It is also recommended to call out error codes encountered and enumerated as in the
59+
in the following table:
60+
61+
| Code | Message | Description |
62+
|---------------------|----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
63+
| `EXTENSION_UNKNOWN` | Extension is unknown | This error MAY be returned when a extension is unknown to the registry in a specified repository. This can be returned with a standard get or if a manifest references an unknown layer during upload. |
64+
65+
## Pagination
66+
67+
Extensions implementing pagination and SHOULD align with the
68+
[pagination](./spec.md#pagination) specification.
69+
70+
Extension MAY provide enumeration without lexical ordering and in this case,
71+
it is not required to support the `last` parameter. Clients are NOT RECOMMENDED to construct the `link` and SHOULD treat the URL as opaque.
4372

4473
## Prior Art
4574

ext/ext-0.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

ext/ext.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# _ext - Index of Distribution Extensions
2+
3+
## Summary
4+
5+
This base extension is used to discover and return an array of extensions.
6+
7+
## Reference Explanation
8+
9+
The base extension may be queried through a `GET` to discover available
10+
extensions.
11+
12+
Registry level extensions may be discovered with a standard GET as follows.
13+
14+
```HTTP
15+
GET /v2/_ext/
16+
```
17+
18+
Repository level extensions may be discovered with a standard GET as follows.
19+
20+
```HTTP
21+
GET /v2/{name}/_ext/
22+
```
23+
24+
The base extension returns an array of supported extensions with details of the
25+
endpoints as shown below.
26+
27+
```HTTP
28+
200 OK
29+
Content-Length: <length>
30+
Content-Type: application/json
31+
32+
{
33+
"extensions: [
34+
"_<ns>/<ext>/<component>",
35+
]
36+
}
37+
```
38+
39+
### *Extensions* Property Descriptions
40+
41+
- **`extensions`** *array of strings*
42+
43+
This REQUIRED property contains a list of supported extension endpoints.
44+
45+
The [relative URI]((https://tools.ietf.org/doc/html/rfc1808))
46+
which MAY be constructed by replacing
47+
the base discovery extension path,`_ext`.
48+
49+
## Error Codes
50+
51+
Registry implementations MAY chose to not support any extension and the base
52+
extension MAY return the following error message.
53+
54+
| Code | Message | Description |
55+
|---------------|-------------------------------|---------------------------------------------------------------------------------------------|
56+
| `UNSUPPORTED` | The operation is unsupported. | The operation was unsupported due to a missing implementation or invalid set of parameters. |

0 commit comments

Comments
 (0)