Esempio n. 1
0
        public PadIntRegistry RemovePadInt(int uid)
        {
            PadIntRegistry pd = GetPadInt(uid);

            padIntList.Remove(pd);
            return(pd);
        }
Esempio n. 2
0
        /// <summary>
        /// Associates an uid, to a server and a transaction, so it is later involved in commit or abort
        /// </summary>
        /// <param name="serverID">Server identifier</param>
        /// <param name="uid">PadInt identifier</</param>
        internal void AddPadInt(int serverID, PadIntRegistry pd)
        {
            Logger.Log(new String[] { "Cache", "AddPadInt", "serverID", serverID.ToString() });

            ServerRegistry serverRegistry = GetServer(serverID);

            if (serverRegistry != null)
            {
                serverRegistry.PdInts.Add(pd);
            }
            else
            {
                throw new WrongPadIntRequestException(pd.UID, serverID);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Updates a PadInt's server stored in cache
        /// </summary>
        /// <param name="serverID">Server identifier</param>
        /// <param name="uid">PadInt identifier</param>
        internal void UpdatePadIntServer(int serverID, int uid)
        {
            try {
                Tuple <int, string> serverInfo = PadiDstm.MasterServer.GetPadIntServer(uid);
                string serverAddr  = serverInfo.Item2;
                int    newServerID = serverInfo.Item1;

                //obtains and removes the PadIntRegistry from the old server
                PadIntRegistry pd = GetServer(serverID).RemovePadInt(uid);

                if (!HasServer(newServerID))
                {
                    AddServer(newServerID, serverAddr);
                }
                //adds the PadIntRegistry to the new server
                AddPadInt(newServerID, pd);
            } catch (PadIntNotFoundException) {
                throw;
            }
        }
Esempio n. 4
0
 public void AddPadInt(PadIntRegistry pd)
 {
     padIntList.Add(pd);
 }