private void StartInternal(BackupDataSource source, BackupDataSource destination, OnErrorDelegate onError) { try { this.Start(source, destination, null); } catch (Exception e) { // Pass the exception to the calling thread onError(e); } }
public void Start(BackupDataSource source, BackupDataSource destination, ProgressChangeDelegate progressChange) { this.source = source; if (this.State.InProgress) { throw new ApplicationException("A backup operation is already in progress."); } this.State.InProgress = true; this.State.ProgressPercentage = 0; this.progressChange = progressChange; // Transfer the data from the source to the destination source.TransferData(destination, ProgressChange); this.State.InProgress = false; }
public void Start(BackupDataSource source, BackupDataSource destination, ProgressChangeDelegate progressChange) { this.source = source; if (this.State.InProgress) { throw new ApplicationException("A backup operation is already in progress."); } this.State.InProgress = true; this.State.ProgressPercentage = 0; this.progressChange = progressChange; // Transfer the data from the source to the destination source.TransferData(destination, ProgressChange); this.State.InProgress = false; }
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 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 void StartAsync(BackupDataSource source, BackupDataSource destination) { StartDelegate startDelegate = new StartDelegate(StartInternal); startDelegate.BeginInvoke(source, destination, OnError, null, null); }
public void StartAsync(BackupDataSource source, BackupDataSource destination) { StartDelegate startDelegate = new StartDelegate(StartInternal); startDelegate.BeginInvoke(source, destination, OnError, null, null); }
private void StartInternal(BackupDataSource source, BackupDataSource destination, OnErrorDelegate onError) { try { this.Start(source, destination, null); } catch (Exception e) { // Pass the exception to the calling thread onError(e); } }
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 abstract void TransferData(BackupDataSource destination, ProgressChange progressChange);
public abstract void TransferData(BackupDataSource destination, ProgressChange progressChange);