THE SQL Server Blog Spot on the Web

Welcome to SQLblog.com - The SQL Server blog spot on the web Sign in | |
in Search

Buck Woody

Carpe Datum!

Windows Azure Storage - Creating a Hierarchy View

When you declare and use storage in Windows Azure - specifically in a BLOB object - it’s just a grouping of storage. There are two types of BLOBs - Page and Block. To use storage, you need a storage account, which hold Containers, and then you put a BLOB object in the Container. You address that using the API, which in turn uses a REST call to access the data.

So the URL that you are actually sending looks like this:

http://myaccount.blob.core.windows.net/mycontainer/myblob

Here are the parts you’re calling:

myaccount: The name of your account. This is protected by a key.

blob.core.windows.net: This is the Windows Azure Storage System. Doesn't change.

mycontainer: The container you make that holds BLOB objects.

myblob: The BLOB storage object you create, fill, edit and so on.

This URL must be unique, so simply making more containers makes another “path” for a BLOB for you, like this:

http://myaccount.blob.core.windows.net/myothercontainer/myblob

But that’s a bit heavy-handed. What if you want to expose something that looks more like a hierarchy, say, something like this:

http://myaccount.blob.core.windows.net/myothercontainer/myblob/myfile.jpg

You can do that - although it’s not an actual hierarchy, you can make it appear that way by using the forward-slash and even the period character in the name of the BLOB. In other words, the BLOB would have the name:

myblob/myfile.jpg

There are some caveats here. Even though you are allowed to include these characters in the names, don’t end the BLOB name with a period or forward slash. And although the system will preserve the case you create the BLOB names with and then allow you to ignore that case for various operations, it’s best to be consistent. There are times when case does matter in Windows Azure coding, so it’s simpler to treat things as case-sensitive to begin with.

You can learn more about this construct here: http://msdn.microsoft.com/en-us/library/dd135715.aspx 

Published Tuesday, July 19, 2011 7:30 AM by BuckWoody

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
(required) 
Submit

About BuckWoody

http://buckwoody.com/BResume.html

This Blog

Syndication

Powered by Community Server (Commercial Edition), by Telligent Systems
  Privacy Statement