/// <summary> /// Loads a lagern index. /// </summary> /// <returns></returns> private (BlobStore blobs, BackupStore backups) LoadIndex() { BlobStoreDependencies blobStoreDependencies = new BlobStoreDependencies(DstFSInterop); BlobStore blobs = BlobStore.deserialize(DstFSInterop.LoadIndexFileAsync(null, IndexFileType.BlobIndex).Result, blobStoreDependencies); BackupStoreDependencies backupStoreDependencies = new BackupStoreDependencies(DstFSInterop, blobs); BackupStore backups = new BackupStore(backupStoreDependencies); return(blobs, backups); }
public static CoreDstDependencies InitializeNew(string bsname, IDstFSInterop dstinterop, bool cacheused = false) { CoreDstDependencies destdeps = new CoreDstDependencies(dstinterop); if (destdeps.DstFSInterop.IndexFileExistsAsync(bsname, IndexFileType.BackupSet).Result) { throw new Exception("A backup set of the given name already exists at the destination"); } if (!destdeps.DstFSInterop.IndexFileExistsAsync(null, IndexFileType.BlobIndex).Result) { BlobStoreDependencies blobStoreDependencies = new BlobStoreDependencies(destdeps.DstFSInterop); destdeps.Blobs = new BlobStore(blobStoreDependencies); destdeps.SaveBlobStoreIndex(); } else { throw new Exception(); // TODO: Exception message } BackupStoreDependencies backupStoreDependencies = new BackupStoreDependencies(destdeps.DstFSInterop, destdeps.Blobs); destdeps.Backups = new BackupStore(backupStoreDependencies); destdeps.Backups.SaveBackupSet(new BackupSet(cacheused), bsname); return(destdeps); }