Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

IBlob.createBlockBlob should return etag of created object #365

Closed
jcookems opened this issue May 18, 2012 · 0 comments
Closed

IBlob.createBlockBlob should return etag of created object #365

jcookems opened this issue May 18, 2012 · 0 comments

Comments

@jcookems
Copy link
Contributor

When a blob is created, the service returns a message like this (with some parts elided)

HTTP/1.1 201 Created
Last-Modified: Thu, 17 May 2012 17:54:50 GMT
ETag: "0x8CF026D4A29F829"

The ETag is especially important, because that allows you to ensure that the blob is in the state you think it should be in. For example, if after creating the blob, you want to set some metadata, and you want to be sure that the blob has not been altered by anyone else in the meantime, you would use code like this:

$options = new SetBlobMetadataOptions();
$options->setAccessCondition(AccessCondition::ifMatch($etag));
$service.setBlobMetadata($container, $blob, $metadata, $options);

However, the createBlockBlob is a void method; it returns nothing. So you cannot pass the ETag, and you lose confidence that you are the only one touching the blob. (Reading the blob to get the ETag won't help, because you will have the same latency as just setting the metadata blindly.)

(See Azure/azure-sdk-for-java#74 for the same issue in Java)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants