コード例 #1
0
ファイル: ExecuteRestore.cs プロジェクト: bspell1/SkyFloe
 /// <summary>
 /// Releases resources associated with the task
 /// </summary>
 public override void Dispose()
 {
     base.Dispose();
      if (this.restore != null)
     this.restore.Dispose();
      this.restore = null;
 }
コード例 #2
0
ファイル: ExecuteRestore.cs プロジェクト: bspell1/SkyFloe
 /// <summary>
 /// Task execution override
 /// </summary>
 protected override void DoExecute()
 {
     // prepare the restore plugin for the session
      // and mark it as in-progress
      using (var txn = new TransactionScope(TransactionScopeOption.Required, TimeSpan.MaxValue))
      {
     this.restore = this.Archive.PrepareRestore(this.Session);
     if (this.Session.State == SkyFloe.Restore.SessionState.Pending)
     {
        this.Session.State = SkyFloe.Restore.SessionState.InProgress;
        this.Archive.RestoreIndex.UpdateSession(this.Session);
     }
     txn.Complete();
      }
      this.limiter = new IO.RateLimiter(this.Session.RateLimit);
      this.copier = new IO.StreamCopier();
      for (; ; )
      {
     this.Canceler.ThrowIfCancellationRequested();
     // fetch and restore the next pending entry
     var entry = this.Archive.RestoreIndex.LookupNextEntry(this.Session);
     if (entry == null)
        break;
     RestoreEntry(entry);
      }
      // there are no more pending restore entries, so complete the session
      this.Session.State = SkyFloe.Restore.SessionState.Completed;
      this.Archive.RestoreIndex.UpdateSession(this.Session);
 }