Categories

See More
Popular Forum

MBA (4887) B.Tech (1769) Engineering (1486) Class 12 (1030) Study Abroad (1004) Computer Science and Engineering (988) Business Management Studies (865) BBA (846) Diploma (746) CAT (651) B.Com (648) B.Sc (643) JEE Mains (618) Mechanical Engineering (574) Exam (525) India (462) Career (452) All Time Q&A (439) Mass Communication (427) BCA (417) Science (384) Computers & IT (Non-Engg) (383) Medicine & Health Sciences (381) Hotel Management (373) Civil Engineering (353) MCA (349) Tuteehub Top Questions (348) Distance (340) Colleges in India (334)
See More

Increase blob upload performance

General Tech Bugs & Fixes
Max. 2000 characters
Replies

usr_profile.png
Sam Curran

User

( 7 months ago )

 

I am working on integrating a c++ application with Azure blob storage. To achieve this I have implemented a wrapper class around wastorage 4.0 APIs.

#include "stdafx.h"
#include "AzureStorage.h"
// Microsoft Azure Library Header Includes.
#include "was\storage_account.h"
#include "was\blob.h"

struct RadAzureData{
    azure::storage::cloud_storage_account storage_account;
    azure::storage::cloud_blob_client blob_client;
    azure::storage::cloud_blob_container container;
};

   RadAzureStorage::RadAzureStorage():
   RadCloudStorageInterface(RAD_STORAGE_TYPE::AZURE_CLOUD)
   {
   }

   RadAzureStorage::RadAzureStorage(std::string accountName1, std::string     accountKey1, std::string containerName1) :        RadCloudStorageInterface(RAD_STORAGE_TYPE::AZURE_CLOUD)
   {
       std::wstring accountNameWS(accountName1.begin(), accountName1.end());
       std::wstring accountKeyWS(accountKey1.begin(), accountKey1.end());
       std::wstring containerNameWS(containerName1.begin(), containerName1.end());
       d = new RadAzureData();
       accountName = accountNameWS;
       accountKey = accountKeyWS;
       containerName = containerNameWS;
       std::wstring connStr1 = L"AccountName=" + accountName + L";AccountKey=" + accountKey + L";DefaultEndpointsProtocol=https";
       d->storage_account =        azure::storage::cloud_storage_account::parse(connStr1.c_str());
       // Create a blob container
       d->blob_client = d->storage_account.create_cloud_blob_client();
       d->container = d->blob_client.get_container_reference(containerName.c_str());
       CreateContainer();
   }


   bool RadAzureStorage::CreateContainer()
   {
       try
       {
           d->container.create_if_not_exists();
       }

       catch (const azure::storage::storage_exception& e)
       {
          cout<<"Exception in container creation: " << e.what()<<endl;
          cout <<"The request that started at:" << e.result().start_time().to_string().c_str
								

what's your interest