コード例 #1
0
ファイル: PADI_Worker.cs プロジェクト: gayana06/padi
 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);
     }
 }
コード例 #2
0
ファイル: PADI_Worker.cs プロジェクト: gayana06/padi
        /// <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);
        }
コード例 #3
0
ファイル: PADI_Worker.cs プロジェクト: gayana06/padi
 /// <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);
     }
 }
コード例 #4
0
ファイル: PADI_Worker.cs プロジェクト: gayana06/padi
 /// <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!");
     }
 }