Exemplo n.º 1
0
 public void AddShuffleData(int key, ServerPadInt value)
 {
     if (value.IsCommited && !padIntShuffelList.ContainsKey(key))
     {
         ServerPadInt serverPadInt = new ServerPadInt(key, this, value.WriteTS, value.ReadTSList, value.TentativeList, value.IsCommited, value.Value);
         padIntShuffelList.Add(key, serverPadInt);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Inform the availability of the requested ServerPdInt in the server
        /// </summary>
        /// <param name="uid"></param>
        /// <returns></returns>
        public bool AccessPadInt(int uid)
        {
            bool         isAccessed = false;
            ServerPadInt padInt     = null;

            if (padIntActiveList.ContainsKey(uid))
            {
                padInt     = padIntActiveList[uid];
                isAccessed = true;
            }
            return(isAccessed);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Create a ServerPadInt for the requests of clients
 /// </summary>
 /// <param name="uid"></param>
 /// <returns></returns>
 public bool CreatePadInt(int uid)
 {
     lock (this)
     {
         bool         isCreated = false;
         ServerPadInt newPadInt = null;
         if (!padIntActiveList.ContainsKey(uid))
         {
             newPadInt = new ServerPadInt(uid, this);
             padIntActiveList.Add(uid, newPadInt);
             isCreated = true;
         }
         return(isCreated);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Connect the replica and update the results
 /// </summary>
 /// <param name="replicaPadints"></param>
 public void UpdateReplica(Dictionary <int, ServerPadInt> replicaPadints)
 {
     lock (this)
     {
         foreach (var replica in replicaPadints)
         {
             if (padIntReplicaList.ContainsKey(replica.Key))
             {
                 padIntReplicaList.Remove(replica.Key);
             }
             ServerPadInt serverPadInt = new ServerPadInt(replica.Key, this, replica.Value.WriteTS, replica.Value.ReadTSList, replica.Value.TentativeList, replica.Value.IsCommited, replica.Value.Value);
             padIntReplicaList.Add(replica.Key, serverPadInt);
         }
         //Console.WriteLine("Successfully updated the replicas!");
     }
 }