/// <summary> /// Initializes a new archive instance /// </summary> /// <param name="path"> /// The path to the archive subdirectory /// </param> public FileSystemArchive(IO.Path path) { this.Path = path; var restoreIndexPath = new IO.Path( Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "SkyFloe", "FileStore", this.Name, "restore.db" ); IO.FileSystem.CreateDirectory(restoreIndexPath.Parent); this.restoreIndex = (IO.FileSystem.GetMetadata(restoreIndexPath).Exists) ? Sqlite.RestoreIndex.Open(restoreIndexPath) : Sqlite.RestoreIndex.Create(restoreIndexPath, new Restore.Header()); }
/// <summary> /// Releases the resources associated with the archive /// </summary> public void Dispose() { if (this.backupIndex != null) this.backupIndex.Dispose(); if (this.restoreIndex != null) this.restoreIndex.Dispose(); if (this.tempIndex != null) this.tempIndex.Dispose(); this.backupIndex = null; this.restoreIndex = null; this.tempIndex = null; }
/// <summary> /// Initializes a new archive instance /// </summary> /// <param name="s3"> /// The connected AWS S3 client /// </param> /// <param name="glacier"> /// The connected AWS Glacier client /// </param> /// <param name="vault"> /// The name of the Glacier vault for the archive /// </param> /// <param name="bucket"> /// The name of the S3 bucket containing the backup index /// </param> /// <param name="name"> /// The name of the archive /// </param> public GlacierArchive( Amazon.S3.AmazonS3 s3, Amazon.Glacier.AmazonGlacierClient glacier, String vault, String bucket, String name) { this.s3 = s3; this.glacier = glacier; this.vault = vault; this.bucket = bucket; this.name = name; // connect to the restore index var restoreIndexPath = new IO.Path( Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "SkyFloe", "AwsGlacier", name, "restore.db" ); IO.FileSystem.CreateDirectory(restoreIndexPath.Parent); this.restoreIndex = (IO.FileSystem.GetMetadata(restoreIndexPath).Exists) ? Sqlite.RestoreIndex.Open(restoreIndexPath) : Sqlite.RestoreIndex.Create(restoreIndexPath, new Restore.Header()); this.copier = new IO.StreamCopier(); }