public override void TransferData(BackupDataSource destination, ProgressChange progressChange) { // Get the backup file from blob CloudBlockBlob zipBlob = this.container.GetBlockBlobReference(this.filename); BlobStream zipStream = zipBlob.OpenRead(); // Create a temp file for xml file CloudBlockBlob xmlBlob = container.GetBlockBlobReference(this.xmlFilename); BlobStream xmlStream = xmlBlob.OpenWrite(); // Unzip the backup file this.UnzipFile(zipStream, xmlStream); // Set delegate to class variable this.blockTransfer = destination.WriteData; this.progressChange = progressChange; // Open a stream to the xml file using (this.inStream = new StreamReader(xmlBlob.OpenRead())) { // The total number of backup operations is determined by the strem size this.TotalOperations = (int)this.inStream.BaseStream.Length; // Initialise detination writer destination.InitialiseWriting(this.GetTables(this.inStream)); // Split stream into batches & trigger delegate this.BatchStream(this.BlockTranferWithProgressUpdate, this.inStream.BaseStream); if (this.Cancelled) { // Exit the function if the user has cancelled return; } // Finalise detination writer destination.FinaliseWriting(); } // Delete the xml file xmlBlob.Delete(); }
public override void TransferData(BackupDataSource destination, ProgressChange progressChange) { // Get all tables var tables = this.cloudTableClient.ListTables().ToArray(); // The total number of backup operations is determined by the table count this.TotalOperations = tables.Length; string nextPartitionKey = null; string nextRowKey = null; int currentTable = 1; // Initialise detination writer destination.InitialiseWriting(tables); // Iterate through each table foreach (string table in tables) { if (this.Cancelled) { // Exit the function if the user has cancelled return; } // Retrieve all entities for this table in blocks do { // Trigger delegate, passing in stream retrieved from table storage this.BatchStream(destination.WriteData, GetTableData(table, ref nextPartitionKey, ref nextRowKey)); }while (nextPartitionKey != null || nextRowKey != null); this.UpdateProgressPercentage(currentTable, progressChange); currentTable++; } // Finalise detination writer destination.FinaliseWriting(); }
public override void TransferData(BackupDataSource destination, ProgressChange progressChange) { // Get the backup file from blob CloudBlockBlob zipBlob = this.container.GetBlockBlobReference(this.filename); BlobStream zipStream = zipBlob.OpenRead(); // Create a temp file for xml file CloudBlockBlob xmlBlob = container.GetBlockBlobReference(this.xmlFilename); BlobStream xmlStream = xmlBlob.OpenWrite(); // Unzip the backup file this.UnzipFile(zipStream, xmlStream); // Set delegate to class variable this.blockTransfer = destination.WriteData; this.progressChange = progressChange; // Open a stream to the xml file using (this.inStream = new StreamReader(xmlBlob.OpenRead())) { // The total number of backup operations is determined by the strem size this.TotalOperations = (int)this.inStream.BaseStream.Length; // Initialise detination writer destination.InitialiseWriting(this.GetTables(this.inStream)); // Split stream into batches & trigger delegate this.BatchStream(this.BlockTranferWithProgressUpdate, this.inStream.BaseStream); if (this.Cancelled) { // Exit the function if the user has cancelled return; } // Finalise detination writer destination.FinaliseWriting(); } // Delete the xml file xmlBlob.Delete(); }
public override void TransferData(BackupDataSource destination, ProgressChange progressChange) { // Get all tables var tables = this.cloudTableClient.ListTables().ToArray(); // The total number of backup operations is determined by the table count this.TotalOperations = tables.Length; string nextPartitionKey = null; string nextRowKey = null; int currentTable = 1; // Initialise detination writer destination.InitialiseWriting(tables); // Iterate through each table foreach (string table in tables) { if (this.Cancelled) { // Exit the function if the user has cancelled return; } // Retrieve all entities for this table in blocks do { // Trigger delegate, passing in stream retrieved from table storage this.BatchStream(destination.WriteData, GetTableData(table, ref nextPartitionKey, ref nextRowKey)); } while (nextPartitionKey != null || nextRowKey != null); this.UpdateProgressPercentage(currentTable, progressChange); currentTable++; } // Finalise detination writer destination.FinaliseWriting(); }