I'm getting a little confused with blobs. I've read some articles that says that there are two kinds of blobs, blocks and pages, but I can see in the SDK's library a third one:
container.GetBlockBlobReference(); // Block Blob, max 64Mb per block, max 200Gb in total.
container.GetPageBlobReference(); // Page Blob, aligned to 512bytes pages, max 1Tb in total.
container.GetBlobReference(); // ??
Is CloudBlob
a CloudBlockBlob
or a CloudPageBlock
? Which constrains applies? Do I have to worry about file size and put blocks or pages when I use that reference?
I've been reading MSDN but I cannot find which one is.
The storage service offers three types of blobs, block blobs, append blobs, and page blobs.
The size of a single block blob is slightly higher than the normal, 4.75 TB, so the total size is 100 MB x 50,000 blocks. You can insert, delete, and replace blobs. Page Blobs: They are comprised of 512-byte pages that are optimized for arbitrary read and write operations.
Page blobs are used primarily as the backing storage for the VHDs used to provide durable disks for Azure Virtual Machines (Azure VMs). They are named page blobs because they provide random read/write access to 512-byte pages.
GetBlobReference
returns you a CloudBlob
object. That can represent either kind of blob. The .ToPageBlob
and .ToBlockBlob
properties will aid in casting the object, but that has nothing to do with the type of the blob that exists. The blob that exists is of one type or the other, specified when you create it.
If you call .Create
on a CloudPageBlob
object, that will result in a page blob being created in Windows Azure.
If you call .UploadText()
on a BlockBlobObject
(or a generic CloudBlob
object), that will result in a block blob being created in Windows Azure.
In other words, GetBlobReference
returns you a generic reference to a blob (not to either type).
It seems to always create a block blob on Azure when you use the generic CloudBlob object. However you are able to retrieve both block blobs and page blobs from storage using that class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With