private void DoInc() { //this.Backups[0].DoJob(); IncrementalBackup diff = new IncrementalBackup(null); diff.DOOT(); }
public void Can_make_multiple_min_inc_backups_and_then_restore() { const int UserCount = 5000; _tempDir = Guid.NewGuid().ToString(); var storageEnvironmentOptions = StorageEnvironmentOptions.ForPath(_tempDir); storageEnvironmentOptions.IncrementalBackupEnabled = true; using (var envToSnapshot = new StorageEnvironment(storageEnvironmentOptions)) { int index = 0; for (int xi = 0; xi < 5; xi++) { for (int yi = 0; yi < 2; yi++) { using (var tx = envToSnapshot.NewTransaction(TransactionFlags.ReadWrite)) { var tree = envToSnapshot.CreateTree(tx, "test"); for (int i = 0; i < UserCount / 10; i++) { tree.Add("users/" + index, "john doe/" + index); index++; } tx.Commit(); } } var snapshotWriter = new MinimalIncrementalBackup(); snapshotWriter.ToFile(envToSnapshot, Path.Combine(_tempDir, xi + ".snapshot")); } } var incremental = new IncrementalBackup(); var restoredOptions = StorageEnvironmentOptions.ForPath(Path.Combine(_tempDir, "restored")); incremental.Restore(restoredOptions, Enumerable.Range(0, 5).Select(i => Path.Combine(_tempDir, i + ".snapshot"))); using (var snapshotRestoreEnv = new StorageEnvironment(restoredOptions)) { using (var tx = snapshotRestoreEnv.NewTransaction(TransactionFlags.Read)) { var tree = tx.ReadTree("test"); Assert.NotNull(tree); for (int i = 0; i < UserCount; i++) { var readResult = tree.Read("users/" + i); Assert.NotNull(readResult); Assert.Equal("john doe/" + i, readResult.Reader.ToStringValue()); } } } }
public unsafe void Min_inc_backup_is_smaller_than_normal_inc_backup() { const int UserCount = 5000; _tempDir = Guid.NewGuid().ToString(); var storageEnvironmentOptions = StorageEnvironmentOptions.ForPath(_tempDir); storageEnvironmentOptions.IncrementalBackupEnabled = true; using (var envToSnapshot = new StorageEnvironment(storageEnvironmentOptions)) { for (int xi = 0; xi < 10; xi++) { using (var tx = envToSnapshot.NewTransaction(TransactionFlags.ReadWrite)) { var tree = envToSnapshot.CreateTree(tx, "test"); for (int i = 0; i < UserCount / 10; i++) { tree.Add("users/" + i, "john doe/" + i); } tx.Commit(); } } var incrementalBackupInfo = envToSnapshot.HeaderAccessor.Get(ptr => ptr->IncrementalBackup); var snapshotWriter = new MinimalIncrementalBackup(); snapshotWriter.ToFile(envToSnapshot, Path.Combine(_tempDir, "1.snapshot")); // reset the incremental backup stuff envToSnapshot.HeaderAccessor.Modify(ptr => ptr->IncrementalBackup = incrementalBackupInfo); var incBackup = new IncrementalBackup(); incBackup.ToFile(envToSnapshot, Path.Combine(_tempDir, "2.snapshot")); var incLen = new FileInfo(Path.Combine(_tempDir, "2.snapshot")).Length; var minInLen = new FileInfo(Path.Combine(_tempDir, "1.snapshot")).Length; Assert.True(incLen > minInLen); } }
public Stream Open(IncrementalBackup backup) { throw new NotImplementedException(); }
public VirtualMachineIncrementalBackupCreated(VirtualMachine virtualMachine, IncrementalBackup backup) { VirtualMachine = virtualMachine; Backup = backup; }
public Task Execute(IJobExecutionContext context) { int ID = (int)context.MergedJobDataMap.Get("ID"); Template Temp = Api_Helper.Temp_Get().Result.First(x => x.id == ID); string Type = Temp.Type_Of_Backup.ToUpper(); if (Type == "FULL") { var FullBackup = new FullBackup(Temp.Source, Temp.Destination, Temp.Save_Options); } else if (Type == "DIFF") { var DiffBackup = new DifferentialBackup(Temp.Source, Temp.Destination, Temp.Save_Options); } else if (Type == "INC") { var IncBackup = new IncrementalBackup(Temp.Source, Temp.Destination, Temp.Save_Options); } else if (Type == "UNCFULL") { using (UNCAccessWithCredentials.UNCAccessWithCredentials unc = new UNCAccessWithCredentials.UNCAccessWithCredentials()) { if (unc.NetUseWithCredentials(@"\\kacenka.litv.sssvt.cz\StudentiPrenosne\PerinaRadek", "perinaradek", "litv", "okmujm987")) { var FullBackup = new FullBackup(Temp.Source, Temp.Destination, Temp.Save_Options); } else { throw new Exception("Neplatné přihlašovací údaje"); } } } else if (Type == "UNCINC") { using (UNCAccessWithCredentials.UNCAccessWithCredentials unc = new UNCAccessWithCredentials.UNCAccessWithCredentials()) { if (unc.NetUseWithCredentials(@"\\kacenka.litv.sssvt.cz\StudentiPrenosne\PerinaRadek", "perinaradek", "litv", "okmujm987")) { var IncBackup = new IncrementalBackup(Temp.Source, Temp.Destination, Temp.Save_Options); } else { throw new Exception("Neplatné přihlašovací údaje"); } } } else if (Type == "UNCDIFF") { using (UNCAccessWithCredentials.UNCAccessWithCredentials unc = new UNCAccessWithCredentials.UNCAccessWithCredentials()) { if (unc.NetUseWithCredentials(@"\\kacenka.litv.sssvt.cz\StudentiPrenosne\PerinaRadek", "perinaradek", "litv", "okmujm987")) { var DiffBackup = new DifferentialBackup(Temp.Source, Temp.Destination, Temp.Save_Options); } else { throw new Exception("Neplatné přihlašovací údaje"); } } } else { Task.WaitAll(Api_Helper.Bac_Post(new Backup { Made = DateTime.Now, Name = Type + " " + DateTime.Now, Job = 30, Size = Temp.Destination, Succesful = false })); throw new Exception("Unexpected type of backup :/"); } Console.WriteLine("BACKUP DONE"); Console.WriteLine("ID: " + Temp.id); Console.WriteLine("Type: " + Temp.Type_Of_Backup); Task.WaitAll(Api_Helper.Bac_Post(new Backup { Made = DateTime.Now, Name = Type + " " + DateTime.Now, Job = 30, Size = Temp.Destination, Succesful = true })); return(Task.CompletedTask); }