TAzureBlobManagement

From RAD Studio
Jump to: navigation, search

Go Up to Azure and Cloud Computing with DataSnap

Warning: DSAzure API is deprecated and has been replaced by Data.Cloud.AzureAPI. You are encouraged to use the new API when developing cloud computing applications. See Cloud Computing with DataSnap for more information.
Note: The TAzureBlobManagement component is available in the Tool Palette only if you install the dclWindowsAzureManagement190.bpl package, that you can find in the bin folder of the RAD Studio installation folder. TAzureBlobManagement is only available for VCL applications.

The TAzureBlobManagement component is used to manipulate blobs (or Binary Large Objects). To use the TAzureBlobManagement component, drop it on a form. Then drop the TAzureConnectionString component from the Tool Palette. Specify connection information in the TAzureConnectionString component, then connect both components. Do not forget to activate the Azure Blobs table.

Once you have your application running and the blob component activated, you can right-click the root node to add a new blob or to refresh the list of blobs.

Note: Naming conventions are the same as for the table component. Hyphens (-) are not allowed within the name.

Other operation options available while the application is running and you are within a TAzureBlobManagement component are: Create Container, Copy Blob, Block Blob Properties, Create Block Blob, Create Snapshot Blob, and Page Blob.

Node Types

The blob storage basically handles these few things: containers, page blobs, block blobs, access control lists, properties, and metadata.

Containers

Containers can be added under the root node, and can contain all of the above mentioned nodes, except for other containers (with the exception of the root container, which will be discussed later).

When creating a container you give it a name, any metadata key/value pairs you like and set the public access setting to what you want it to be. This setting specifies if the stored data in the container can be accessed publically or not.

Once a container is created, you can right-click it and choose to create one of the blob types, modify the public access setting, edit the metadata, refresh the container to bring it in sync with the server, or delete the container.

Metadata

Metadata can be stored on a container or on a blob. This is simply a table of key/value pairs that you want to associate with the particular item, and only have whatever meaning you give to them. Useful information may be something like author name, for example. The metadata can be modified and refreshed at any time, provided that another user has not acquired a lease on the object (for blobs). The Metadata can be refreshed from the context menu of either its own node or any ancestor of the metadata node.

Properties

Properties, like metadata, can be found on both containers and blobs. These are populated by the response sent from the Microsoft Azure cloud, and cannot be modified (directly) by the user. On a container you should see a property, for example, called 'Last-Modified'. Blobs have considerably more properties, which include BlobType, Last-Modified, LeaseStatus (locked/unlocked), and so on. The properties can be refreshed from the context menu of either its own node or any ancestor of the properties node.

Page Blobs

For each page blob on the server there will be a corresponding page blob node. Under this node you will have the properties and metadata, and will also have a Page Regions node. This node will have some information under it about the content. From the context menu, you can choose to download the blob, or perform any of the actions you could from the blob root node.

Page blobs are optimized for random read/write operations.

Block Blobs

For each block blob on the server there will be a corresponding block blob node. Under this node you will have the properties and metadata nodes as always, and will also have a Block List node. This node will have some information under it about the content, and from the context menu you will be able to Add a Block, commit the block list, and everything else you can do on the parent blob node.

Block blobs are optimized for streaming.

Creating a Root Container

If one hasn't been created already, you can right-click the root node (Azure Blobs) and choose to create a root container. Doing so will permit you to allow users to reference a blob from the top level of the blob storage account, instead of needing to reference the specific container name. It will also add directly under the root node a node for properties and metadata for the root container and allow for creating blobs directly under the root node, instead of being nested inside of a container.

Creating a Block Blob

To create a block blob, you choose the appropriate context menu item from the root node (if a root container exists) or on the container you want the blob created in. A dialog will open where you need to specify the blob name (following previously mentioned guidelines), content location (with a file browser dialog), a few additional optional settings, and any metadata you want to add.

Once the blob is created, you can modify it from its context menu as you see fit, updating the metadata or modifying the blocks.

Creating a Page Blob

To create a page blob, you choose the appropriate context menu item from the root node (if a root container exists) or on the container you want the blob created in. A dialog will open where you need to specify the blob name (following previously mentioned guidelines), content length (must be a multiple of 512 bytes), a few additional optional settings, and any metadata you want to add.

Once the blob is created, you can modify it from its context menu as you see fit, updating the metadata or adding pages.

Leasing a Blob

You can acquire a lease on a blob, which will last for 60 seconds unless you choose to release the lease before then. While you have a lease acquired, no other user can acquire a lease or modify the blob unless you give them the lease ID, which can be found in the context menu by navigating to the "Copy Lease ID" item, which will put the lease ID onto your clipboard.

If someone else has acquired a lease, you can choose to break the lease. This will prevent the user from renewing their lease beyond whatever remainder of a minute they have left in their current lease. If the lease isn't broken, a user can continually renew their lease, each time for an additional 60 seconds.

See Also