Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel2
outlinefalse
typelist
printablefalse

This section provides general information about SCSP WRITE that applies to both named and unnamed objects.

WRITE is a request to the storage cluster to create a new object. The WRITE request is formatted as a simple an HTTP request using the POST method.

SCSP Method

HTTP Method

RFC 7231 Section

SCSP WRITE

POST

4.3.3

Info

Write for

...

Contexts

The Swarm setting scsp.requireExplicitContextCreate protects content-bearing objects from being created erroneously as contexts (buckets or domains). With this setting enabled, Swarm

...

does not create a context object unless it includes the required header: Content-type: application/castorcontext. (v9.1)

Info

S3

...

Compatibility

The Swarm setting scsp.autoContentMD5Computation improves S3 compatibility by automating Content-MD5 hashing. the gencontentmd5 query argument or the deprecated Expect: Content-MD5 header does not need to be included on writes (although a separate Content-MD5 header may want to be supplied for content integrity checking). This setting is ignored wherever it is invalid, such as on a multipart initiate/complete or an EC APPEND. (v9.1)

WRITE for

...

Named Objects

The existing object is overwritten with a new version if performing a WRITE of a named object that already exists.

...

  • Swarm WRITEs the named object if the named object does not exist.

  • Swarm responds with a an HTTP 412 Precondition Fail error if the named object exists.

...

Code Block
languagexml
POST /bucket/photo.jpg HTTP/1.1
  If-None-Match: *
  Host: cluster.example.com
  User-Agent: Swarm Client/0.1
  Content-Length: 43402
  Expect: 100-continue
  Content-Type: image/jpeg
  Content-Language: en/us, x-pig-latin
  Content-Version: 42 
  CRLF 
  [ content ]

Using PUT Create for

...

Named Objects

Add the scsp.allowPutCreate=True to the configuration parameters to configure Swarm to allow using the HTTP PUT operation to create new named objects. The putcreate query argument can also enable it.

Info

Exception

Although domains and buckets are named, Swarm processes all PUT requests on these objects as updates, regardless of the setting.

Preventing

...

Overwriting: If-None-Match

In contrast to an unnamed object, the existing object is overwritten with a new version if performing a WRITE of a named object that already exists. Include the If-None-Match: * request header to prevent overwriting an existing object.

  • Swarm WRITEs the named object if the named object does not exist.

  • Swarm responds with a an HTTP 412 Precondition Fail error if the named object exists.

...

Note

Swarm returns

...

an HTTP 412 error on SCSP WRITE of named objects if the domain or bucket does not exist or cannot be loaded.

Info
Note

Important

If‑None‑Match:* can erroneously report that an object exists during the time window after it is flagged for deletion by policy but before it is removed from disk. This window is determined by the HP cycle time.

WRITE for

...

Unnamed Objects

Swarm makes no assumptions about User-Agent (except it is an HTTP/1.1 client). The Host header must conform to the requirements of Section 14.23 of the HTTP/1.1 spec.

...

A new object is created and a new UUID is returned if performing a WRITE of an unnamed object. A new object is created and a new alias UUID is returned if performing a WRITE of an alias object.

See WRITE for Unnamed Objects.

WRITE for alias

...

Objects

Add alias=yes to create alias objects:

...

Code Block
languagexml
POST /?alias HTTP/1.1
  Host: cluster.example.com
  User-Agent: Swarm Client/0.1

WRITE for

...

Erasure-

...

Coded Objects

A new object written to the storage cluster is erasure-coded if it meets the EC criteria language.

See Working with Large Objects.

...

Note

Swarm returns a HTTP 503 Service Unavailable error if performing a WRITE of an object of more than 4 TB in size.

WRITE for

...

Large Files (Expect: 100-

...

Continue)

The Expect: 100-continue header tells the server that the client will wait waits after sending the header lines and before sending the content in the message body. The Swarm server can respond with a redirect or an error response.

  • The server returns a an HTTP 100 Continue response, telling the client to transmit the entity body if the server is ready to store the contents. The client needs to wait for a 100 Continue response from the server before proceeding to send the data.

  • The server sends a an HTTP 413 Request entity too large error response and closes the connection if the server is not ready.

Swarm allows the client to omit the Expect: 100-continue header, sending all the content at once. The server reads and discards all data if it must respond with a redirect or error. Swarm logs a warning for WRITE messages that include more than 65536 bytes:

...

Code Block
languageerl
Please use Expect: 100-continue for large amounts of data.

The cluster returns a an HTTP 507 Insufficient Storage error if any node in the cluster does not have enough space to write the object.

...