user1018513
user1018513

Reputation: 1682

Atomic updates of Azure Blobs

I know that in Azure Table Storage, it's possible to update two entries in a row atomically. Is it possible to update the content + metadata of Azure Blobs atomically?

If I do

blob.Metadata["field"] = "helloworld"
blob.UploadFromStream(stream,accessCondition)

Will that update atomically? (read, if "helloworld" is present, am I guaranteed that the content of blob will be the stream?

Upvotes: 1

Views: 718

Answers (2)

Gaurav Mantri
Gaurav Mantri

Reputation: 136146

Answer to your question is yes, both metadata and stream will be present.

Basically when you do this:

blob.Metadata["field"] = "helloworld"

No network call is being made. This property is stored in blob object.

blob.UploadFromStream(stream,accessCondition)

The line above actually makes the network call and sets the blob content and metadata in blob storage.

Upvotes: 2

Zhaoxing Lu
Zhaoxing Lu

Reputation: 6467

If you are using Block Blob, you can call Put Block to upload content firstly, and then call Put Block List to commit blob content and metadata by one request.

Upvotes: 0

Related Questions