Example #1
0
        public static CoreDstDependencies Load(IDstFSInterop dstinterop, bool cacheused = false)
        {
            CoreDstDependencies destdeps = new CoreDstDependencies(dstinterop);

            // Would possibly load a cached blobindex file here
            (destdeps.Blobs, destdeps.Backups) = destdeps.LoadIndex();
            return(destdeps);
        }
Example #2
0
        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);
        }