Setheron
Setheron

Reputation: 3740

Oracle OCI ObjectStorage -- does an atomic create exists?

Does ObjectStorage have any mechanism that would permit locking (such as an atomic operation to create an object such that the operation fails if the object already exists)? (edited)

Upvotes: 1

Views: 633

Answers (1)

Setheron
Setheron

Reputation: 3740

You can leverage HTTP ifMatch & ifNoneMatch semantics when creating an object.

The If-None-Match HTTP request header makes the request conditional. For GET and HEAD methods, the server will send back the requested resource, with a 200 status, only if it doesn't have an ETag matching the given ones. For other methods, the request will be processed only if the eventually existing resource's ETag doesn't match any of the values listed.

You can refer to the API documentation for the header values, specifically the API calls out:

The entity tag (ETag) to avoid matching. The only valid value is '*', which indicates that the request should fail if the object already exists. For creating and committing a multipart upload, this is the entity tag of the target object. For uploading a part, this is the entity tag of the target part.

Upvotes: 1

Related Questions