0
votes

Our current code uses Azure SDK 1.8 and to generated a shared access signature it would first call CloudBlobContainer.GetBlobReference() and then call CloudBlob.GetSharedAccessSignature(). Same for other operations - first CloudBlobContainer.GetBlobReference() and then some operation on the blob object.

Code never explicitly asks to make block bobs or page blobs - only "just blobs".

Now we need to move to Azure SDK v2.4. Interfaces have changed a lot. Now there're

  • CloudBlobContainer.GetBlobReferenceFromServer(),
  • CloudBlobContainer.GetBlockBlobReference() and
  • CloudBlobContainer.GetPageBlobReference()

and they looks quite the same. We already have a lot of blobs in our storage and would rather leave them unchanged.

So which of the three do we use? Do we treat previously created blobs as block blobs or page blobs?

1
What kind of operations do you want to perform on the blobs using shared access signature?Gaurav Mantri
@GauravMantri: I'll generate a temporary link and give it away so that user can download the file without having credentials. Does it really affect whether my existing blobs are page blobs or block blobs?sharptooth
If your users are downloading via browser, then it doesn't really matter. If they are downloading via a special tool (that you would have to write), then it would make a difference because you could optimize page blob downloads.Gaurav Mantri
@GauravMantri: There're no magic tools, only our code that uses Azure SDK v1.8. We just need to migrate it.sharptooth
I would suggest using any Azure Explorer and do a quick check on the blob type though I have a feeling that you will have block blobs in your storage account.Gaurav Mantri

1 Answers

4
votes

Are blobs created with Azure SDK v1.8 page blobs or block blobs?

If you created them as page blobs, then they will be page blobs otherwise block blobs. Concept of block and page blobs have been around since start and is not new.

You could either use any storage explorer to check if you have any page blobs in your storage account. Other way would be to quick a quick search for PageBlob in your code.

Difference between CloudBlobContainer.GetBlobReferenceFromServer() and CloudBlobContainer.Get[Block|Page]BlobReference()

The biggest difference between GetBlobReferenceFromServer and Get[Block|Page]BlobReference is that former makes a call to the storage service to identify the blob type while the latter just creates an instance of Cloud[Block|Page]Blob object on the client. If the blob is not present, former will throw an error however latter won't because no interaction with the server has been done. Normally you would use former when you don't know the blob type and wouldn't mind making an extra network call just to ensure the blob type.

Do you really need to know the blob type?

The answer depends on the kind of operation you're trying to perform. There are some operations which can only be performed on page blobs and doing them on block blobs will throw an error and vice versa. Also certain operations can be optimized for page blobs (download page blobs for example). There it might be beneficial for you to know the blob type before hand.