Specify and implement Docker-Upload-UUID
This changeset adds support for a header to identify docker upload uuids. This id can be used as a key to manage local state for resumable uploads. The goal is remove the necessity for a client to parse the url to get an upload uuid. The restrictions for clients to use the location header are still strongly in place. Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
parent
47a8ad7a61
commit
996235dc59
5 changed files with 72 additions and 11 deletions
|
@ -347,6 +347,7 @@ with the upload URL in the `Location` header:
|
|||
Location: /v2/<name>/blobs/uploads/<uuid>
|
||||
Range: bytes=0-<offset>
|
||||
Content-Length: 0
|
||||
Docker-Upload-UUID: <uuid>
|
||||
```
|
||||
|
||||
The rest of the upload process can be carried out with the returned url,
|
||||
|
@ -358,6 +359,10 @@ try to assemble the it. While the `uuid` parameter may be an actual UUID, this
|
|||
proposal imposes no constraints on the format and clients should never impose
|
||||
any.
|
||||
|
||||
If clients need to correlate local upload state with remote upload state, the
|
||||
contents of the `Docker-Upload-UUID` header should be used. Such an id can be
|
||||
used to key the last used location header when implementing resumable uploads.
|
||||
|
||||
##### Upload Progress
|
||||
|
||||
The progress and chunk coordination of the upload process will be coordinated
|
||||
|
@ -384,6 +389,7 @@ The response will be similar to the above, except will return 204 status:
|
|||
204 No Content
|
||||
Location: /v2/<name>/blobs/uploads/<uuid>
|
||||
Range: bytes=0-<offset>
|
||||
Docker-Upload-UUID: <uuid>
|
||||
```
|
||||
|
||||
Note that the HTTP `Range` header byte ranges are inclusive and that will be
|
||||
|
@ -453,6 +459,7 @@ current status:
|
|||
Location: /v2/<name>/blobs/uploads/<uuid>
|
||||
Range: 0-<last valid range>
|
||||
Content-Length: 0
|
||||
Docker-Upload-UUID: <uuid>
|
||||
```
|
||||
|
||||
If this response is received, the client should resume from the "last valid
|
||||
|
@ -471,6 +478,7 @@ be returned, including a `Range` header with the current upload status:
|
|||
Location: /v2/<name>/blobs/uploads/<uuid>
|
||||
Range: bytes=0-<offset>
|
||||
Content-Length: 0
|
||||
Docker-Upload-UUID: <uuid>
|
||||
```
|
||||
|
||||
##### Completed Upload
|
||||
|
@ -1787,6 +1795,7 @@ The following parameters should be specified on the request:
|
|||
201 Created
|
||||
Location: <blob location>
|
||||
Content-Length: 0
|
||||
Docker-Upload-UUID: <uuid>
|
||||
```
|
||||
|
||||
The blob has been created in the registry and is available at the provided location.
|
||||
|
@ -1797,6 +1806,7 @@ The following headers will be returned with the response:
|
|||
|----|-----------|
|
||||
|`Location`||
|
||||
|`Content-Length`|The `Content-Length` header must be zero and the body must be empty.|
|
||||
|`Docker-Upload-UUID`|Identifies the docker upload uuid for the current request.|
|
||||
|
||||
|
||||
|
||||
|
@ -1890,6 +1900,7 @@ The following parameters should be specified on the request:
|
|||
Content-Length: 0
|
||||
Location: /v2/<name>/blobs/uploads/<uuid>
|
||||
Range: 0-0
|
||||
Docker-Upload-UUID: <uuid>
|
||||
```
|
||||
|
||||
The upload has been created. The `Location` header must be used to complete the upload. The response should be identical to a `GET` request on the contents of the returned `Location` header.
|
||||
|
@ -1901,6 +1912,7 @@ The following headers will be returned with the response:
|
|||
|`Content-Length`|The `Content-Length` header must be zero and the body must be empty.|
|
||||
|`Location`|The location of the created upload. Clients should use the contents verbatim to complete the upload, adding parameters where required.|
|
||||
|`Range`|Range header indicating the progress of the upload. When starting an upload, it will return an empty range, since no content has been received.|
|
||||
|`Docker-Upload-UUID`|Identifies the docker upload uuid for the current request.|
|
||||
|
||||
|
||||
|
||||
|
@ -2004,6 +2016,7 @@ The following parameters should be specified on the request:
|
|||
204 No Content
|
||||
Range: 0-<offset>
|
||||
Content-Length: 0
|
||||
Docker-Upload-UUID: <uuid>
|
||||
```
|
||||
|
||||
The upload is known and in progress. The last received offset is available in the `Range` header.
|
||||
|
@ -2014,6 +2027,7 @@ The following headers will be returned with the response:
|
|||
|----|-----------|
|
||||
|`Range`|Range indicating the current progress of the upload.|
|
||||
|`Content-Length`|The `Content-Length` header must be zero and the body must be empty.|
|
||||
|`Docker-Upload-UUID`|Identifies the docker upload uuid for the current request.|
|
||||
|
||||
|
||||
|
||||
|
@ -2161,6 +2175,7 @@ The following parameters should be specified on the request:
|
|||
Location: /v2/<name>/blobs/uploads/<uuid>
|
||||
Range: 0-<offset>
|
||||
Content-Length: 0
|
||||
Docker-Upload-UUID: <uuid>
|
||||
```
|
||||
|
||||
The chunk of data has been accepted and the current progress is available in the range header. The updated upload location is available in the `Location` header.
|
||||
|
@ -2172,6 +2187,7 @@ The following headers will be returned with the response:
|
|||
|`Location`|The location of the upload. Clients should assume this changes after each request. Clients should use the contents verbatim to complete the upload, adding parameters where required.|
|
||||
|`Range`|Range indicating the current progress of the upload.|
|
||||
|`Content-Length`|The `Content-Length` header must be zero and the body must be empty.|
|
||||
|`Docker-Upload-UUID`|Identifies the docker upload uuid for the current request.|
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue