Initiating Multipart Write

A multipart, parallel upload is started with an initiate request that can be an SCSP POST, PUT, or APPEND request. If you are appending to an existing object, the object must already be erasure-coded or the request fails. To convert a replicated object to EC, use a 0-byte APPEND with the query arguments erasurecoded=yes and encoding=<k:p>.

Query Argument - The initiate request must include the uploads query argument, and it can specify an immutable, named, or aliased object. The object encoding is determined by the encoding query argument; if the argument is missing, the applicable encoding policy stands. Any body text included on the initiate request is ignored and not included in the final object.

Upload ID - When the request is completed, Swarm returns an upload ID that identifies the upload. This ID serves as the identifier for all subsequent operations associated with the upload. The name or resulting Content-UUID value from the initiate request is the object name used for subsequent operations for the same upload ID.

Important

Do not include a Content-MD5 header in the initiate or complete request. This operation is unsupported and returns a 400 Bad Request error response. To generate a Content-MD5 for an individual part or the completed object, use a separate POST request with the gencontentmd5 SCSP Query Arguments.

Multipart Writing a New Named Object

Example of initiating a multipart write for a named object:

POST /exampleBucket/objectName?domain=yourDomainName&uploads&encoding=5:2 HTTP/1.1  x-custom-header1-meta: value  x-custom-headerN-meta: value

The custom header arguments are included because any custom metadata for the object must be declared with the initiate request. Any content in the body of the request is ignored when the multipart upload is eventually completed.

When complete, Swarm responds with a header that provides an upload ID. Record this ID so you can upload the object parts in subsequent requests.

Example of a header with an upload ID:

Castor-System-UploadId: VXBsb2FkIElEIG...5tMnRzIHVwbG9hZA

Multipart Writing an Immutable Object

Example of initiating a multipart write for an unnamed, immutable object:

POST /?uploads&encoding=5:2 HTTP/1.1  x-custom-header1-meta: value  x-custom-headerN-meta: value

The custom header arguments are included because any custom metadata for the object must be declared with the initiate request. Any content in the body of the request is ignored when the multipart upload is eventually completed.

When complete, Swarm responds with a header that provides an upload ID. Record this ID so you can upload the object parts in subsequent requests.

Example of a header with an upload ID:

Multipart Writing an Existing Object

In addition to creating a new object in the cluster with multipart write, you may overwrite an existing aliased or named object with multipart upload via a PUT request or add data to an existing object via an APPEND request.

The existing object remains distinct and independent until the multipart write operation is completed. When completed, the existing object is replaced by the new object. If you complete the operation with an ABORT request, the existing object remains unchanged.

© DataCore Software Corporation. · https://www.datacore.com · All rights reserved.