예제 #1
0
 public void AddEntry(HashSet <ValueResponse> response)
 {
     lock (_lock)
     {
         foreach (ValueResponse r in response)
         {
             _responsesNotSend.Add(Utils.GenerateUUID(), Encoder.SerializeObjectIndented(r));
         }
     }
 }
        private void Create(string image, bool wait = false, int replica = 0)
        {
            Task t = Task.Run(() => {
                _drivers.Add(image, new HashSet <Driver> {
                    Driver.MakeDriver(image, replica)
                });
            });

            if (wait)
            {
                t.Wait();
            }
        }
예제 #3
0
 public void Enqueue(DataRequest action)
 {
     lock (_lock)
     {
         try
         {
             if (!_dict.ContainsKey(action.Priority))
             {
                 _dict.Add(action.Priority, new Queue <DataRequest>());
             }
         } catch {}
         if (!_dict[action.Priority].Any((a) => a.ID == action.ID))
         {
             _dict[action.Priority].Enqueue(action);
             Logger.Write(Logger.Tag.COMMIT, "Committed [action:" + action.ID.Substring(0, 10) + "...] to self");
         }
     }
 }