コード例 #1
0
ファイル: GlacierArchive.cs プロジェクト: bspell1/SkyFloe
 /// <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.backupIndexFile != null)
     this.backupIndexFile.Dispose();
      this.backupIndexFile = null;
      this.backupIndex = null;
      this.restoreIndex = null;
 }
コード例 #2
0
ファイル: GlacierArchive.cs プロジェクト: bspell1/SkyFloe
 /// <summary>
 /// Opens an existing archive
 /// </summary>
 public void Open()
 {
     // download the existing backup index
      this.backupIndexFile = IO.FileSystem.Temp();
      using (var s3response =
     this.s3.GetObject(
        new Amazon.S3.Model.GetObjectRequest()
        {
           BucketName = this.bucket,
           Key = this.IndexS3Key
        }
     )
      )
      using (var s3Stream = s3response.ResponseStream)
      using (var gzip = new GZipStream(s3Stream, CompressionMode.Decompress))
     this.copier.CopyAndFlush(gzip, this.backupIndexFile);
      // open the index
      this.backupIndex = Sqlite.BackupIndex.Open(this.backupIndexFile.Path);
 }
コード例 #3
0
ファイル: GlacierArchive.cs プロジェクト: bspell1/SkyFloe
 /// <summary>
 /// Creates a new archive
 /// </summary>
 /// <param name="header">
 /// The backup index header to insert
 /// </param>
 public void Create(Backup.Header header)
 {
     // create the Glacier vault, fail if it exists
      this.glacier.CreateVault(
     new Amazon.Glacier.Model.CreateVaultRequest()
     {
        VaultName = this.vault
     }
      );
      // create the local backup index file
      this.backupIndexFile = IO.FileSystem.Temp();
      this.backupIndex = Sqlite.BackupIndex.Create(
     this.backupIndexFile.Path,
     header
      );
      // sync the initialized archive to the S3 bucket
      Save();
 }