Exemple #1
0
 public IConfirmation ReadyItemToProcessingItem()
 {
     if (IsSet)
     {
         return(null);
     }
     var(key, first) = ReadyElements.FirstOrDefault();
     if (first != null)
     {
         ReadyElements.Remove(key);
         Set(first, first.ScopeConfirmation.GetScopeEnd() - first.ScopeConfirmation.GetScopeStart());
     }
     return(first);
 }
Exemple #2
0
        public IConfirmation RevokeJob(Guid confirmationKey)
        {
            if (IsSet && Current.Key.Equals(confirmationKey))
            {
                var rev = Current;
                Reset();
                return(rev);
            }

            var(key, revoked) = ReadyElements.FirstOrDefault(x => x.Value.Key.Equals(confirmationKey));
            if (revoked == null)
            {
                return(null);
            }
            ReadyElements.Remove(key);
            return(revoked);
        }
Exemple #3
0
        /// <summary>
        /// returns true if the update was successful
        /// </summary>
        /// <param name="jobConfirmation"></param>
        /// <returns></returns>
        public bool UpdateJob(IConfirmation jobConfirmation)
        {
            if (IsSet && Current.Key.Equals(jobConfirmation.Key))
            {
                Current = Current.UpdateJob(jobConfirmation.Job);
                //ExpectedResourceIsBusyUntil = jobConfirmation.ScopeConfirmation.GetScopeEnd();
                return(true);
            }

            var(key, ready) = ReadyElements.FirstOrDefault(x => x.Value.Key.Equals(jobConfirmation.Key));
            if (ready == null)
            {
                return(false);
            }
            ReadyElements.Remove(key);
            ReadyElements.Add(key, ready.UpdateJob(jobConfirmation.Job));
            return(true);
        }
Exemple #4
0
 public void Add(IConfirmation confirmation)
 {
     ReadyElements.Add(confirmation.ScopeConfirmation.GetScopeStart(), confirmation);
 }