Changes to allow 2 new modes for ostree object upload #70
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds two new modes of operation on the
POST/objects/:object-id
endpoint, while leaving the current api untouched: Stream Upload and Out of Band Upload.Stream upload
When POSTing bytes using a properly set
Content-Length
header andContent-Type: application/octet-stream
the server will be able to stream the request from the client upstream to amazon s3 or file system without first copying the file to a temporary location.This should be a simple change on the client and this is equivalent to using the curl command:
curl -H 'application/octet-stream' --data-binary @myfile.bin host:/api/v2/objects/:object-id
Out of band upload
This is enabled when using s3 storage only, if the client supplies a
'x-ats-accept-redirect: true
header and asize=<object size>
URL parameter, the server will reply with a redirect response, redirecting the client to an amazon s3 URL the client can use to upload the file using a PUT request and the samecurl
options as above.The server will archive the object after an hour (default value) if the client does not upload the object or report it as uploaded with a PUT request to
PUT /objects/:object-id
If out of band upload is not enabled on the server, but the client is anyway uploading the object using
--data-binary
, settingx-ats-accept-redirect
andsize
, the server will accept the objectand stream it local storage.