Esempio n. 1
0
 public int Leader_GetActionsCompletedCount(string peerID)
 {
     lock (_action_lock)
     {
         if (!ActionsCompleted.ContainsKey(peerID))
         {
             return(0);
         }
         return(ActionsCompleted[peerID].Count);
     }
 }
Esempio n. 2
0
 public void ClearPeerLog(string peerID)
 {
     lock (_batch_lock)
     {
         if (BatchesBehind.ContainsKey(peerID))
         {
             BatchesBehind.Remove(peerID);
         }
     }
     lock (_action_lock)
     {
         if (ActionsCompleted.ContainsKey(peerID))
         {
             ActionsCompleted.Remove(peerID);
         }
     }
 }
Esempio n. 3
0
 public void Leader_RemoveActionsCompleted(string peerID, string action)
 {
     lock (_action_lock)
     {
         if (ActionsCompleted.ContainsKey(peerID))
         {
             if (ActionsCompleted[peerID].Contains(action))
             {
                 ActionsCompleted[peerID].Remove(action);
             }
             // Logger.Write(Logger.Tag.INFO, "Removed " + action.Substring(0,10) +"... from " + peerID);
         }
         else
         {
             ActionsCompleted.Add(peerID, new HashSet <string>());
         }
     }
 }
Esempio n. 4
0
 public HashSet <string> Leader_GetActionsCompleted(string peerID)
 {
     lock (_action_lock)
     {
         if (!ActionsCompleted.ContainsKey(peerID))
         {
             return(new HashSet <string>());
         }
         HashSet <string> behind = new HashSet <string>();
         foreach (string s in ActionsCompleted[peerID].ToList())
         {
             if (!behind.Contains(s) && behind.Count < 10)
             {
                 behind.Add(s);
             }
         }
         return(behind);
     }
 }