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);
        }
Exemple #2
0
        private static ICoreDstDependencies CreateNewDst(Random random)
        {
            DateTime     dateTime = CoreTest.RandomDateTime(random);
            MetadataNode vfsroot  = new(VirtualFSInterop.MakeNewDirectoryMetadata("dst", dateTime), null);

            IDstFSInterop dstFSInterop = VirtualFSInterop.InitializeNewDst(vfsroot, new BPlusTree <byte[]>(10), "");

            return(CoreDstDependencies.InitializeNew("test", false, dstFSInterop));
        }
        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);
        }
Exemple #4
0
 public BackupStoreDependencies(IDstFSInterop cloudinterop, BlobStore blobs)
 {
     DstFSInterop = cloudinterop;
     Blobs        = blobs;
 }
 private CoreDstDependencies(IDstFSInterop dstinterop)
 {
     DstFSInterop = dstinterop;
 }
Exemple #6
0
 public BlobStoreDependencies(IDstFSInterop fsinterop)
 {
     DstFSInterop = fsinterop;
 }
Exemple #7
0
 // Supressing this check because Blobs and Backups must be set to non-null before use publicly.
 #pragma warning disable CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable.
 private CoreDstDependencies(IDstFSInterop dstinterop)
 #pragma warning restore CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable.
 {
     DstFSInterop = dstinterop;
 }