Azure blob parallel copy from one storage to another -


i learning blob block storage. copy block blob 1 storage storage account.usually when uploading system cloud examples saw computing block size , using putblock , putblocklist. use same method copy 1 storage account another. using downloadblocklist able blockid, not able data associated block id.

cloudstorageaccount storageaccount = cloudstorageaccount.parse( configurationmanager.appsettings["storageconnectionstring"]);              cloudblobclient cloudblobclient = storageaccount.createcloudblobclient();              cloudblobcontainer container = cloudblobclient.getcontainerreference("input");              cloudblockblob blob = container.getblockblobreference("cloud.mp4");              list<string> commitedblocks = new list<string>();              ienumerable<listblockitem> blockitem = blob.downloadblocklist(blocklistingfilter.all);             commitedblocks.addrange(blob.downloadblocklist(blocklistingfilter.committed).select(id => id.name));             );  

if able data associated block id can parallel copy of blocks.

thanks

if objective copy blobs 1 storage account another, don't have of :). azure storage api allows perform server side asynchronous copy operation. send request azure storage service copy blob 1 storage account , perform copy operation. since it's asynchronous operation, may want track operation status know when copy operation has finished.

    private static void asynccopyexample()     {         var sourceaccount = new cloudstorageaccount(new storagecredentials("source-account-name", "source-account-key"), true);         var sourcecontainer = sourceaccount.createcloudblobclient().getcontainerreference("source-container-name");         var sourceblockblob = sourcecontainer.getblockblobreference("source-blob-name");         var targetaccount = new cloudstorageaccount(new storagecredentials("target-account-name", "target-account-key"), true);         var targetcontainer = sourceaccount.createcloudblobclient().getcontainerreference("target-container-name");         var targetblockblob = sourcecontainer.getblockblobreference("source-blob-name");         var copyid = targetblockblob.startcopyfromblob(sourceblockblob);//this initiate copy operation         //following code can used check if copy has been completed.         var iscopyoperationinprogress = true;                 {             targetblockblob.fetchattributes();             if (targetblockblob.copystate.status == copystatus.pending)             {                 thread.sleep(1000); //sleep second , check again             }             else             {                 iscopyoperationinprogress = false;             }         } while (iscopyoperationinprogress);     } 

you may find blog post storage team useful: http://blogs.msdn.com/b/windowsazurestorage/archive/2012/06/12/introducing-asynchronous-cross-account-copy-blob.aspx.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -