Increase blob upload performance

General Tech Bugs & Fixes 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years 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

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.