distribution-spec icon indicating copy to clipboard operation
distribution-spec copied to clipboard

Proposal: Change the requirements on tags list and catalog pagination

Open josephschorr opened this issue 4 years ago • 1 comments

Currently, the tags list API and catalog both specify pagination is to occur via the n and last parameters (see: https://github.com/opencontainers/distribution-spec/blob/master/spec.md#tags)

However, the spec also states:

Compliant client implementations SHOULD always use the Link header value when proceeding through results linearly. The client MAY construct URLs to skip forward in the list of tags.

Since implementations are returning the Link header and clients are (AFIAK) nearly always using the Link header to continue the pagination, I'd like to propose that we reduce the requirements, to allow implementations to only support linear iteration via the Link header if they so choose.

For example, Quay currently (in violation of the spec) returns an encoded next_page token rather than last, as it is a much more efficient means of looking up the continuation point for pagination. As this appears to work with all clients today, despite violating the current specification, we'd prefer to not add support for the unoptimized scenario unless absolutely necessary.

I recognize this is a breaking change and, as such, may not be doable, but I thought I'd put it out there anyway :)

josephschorr avatar Mar 23 '20 20:03 josephschorr

It would be worth considering if tag listing API itself can be deprecated and enable something much more richer with continuation tokens. For e.g.

{
    "artifacts" : [
        {
            "tag": "v1",
            "media-type": "application/vnd.oci.image.manifest.v1+json",
            "digest": "sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e4",
            "last-modified" : "...."
        }
    ],
    "next-link": "with continuation token"
}

sajayantony avatar Mar 23 '20 21:03 sajayantony