Ejemplo n.º 1
0
        public void Remove(string key, string value)
        {
            BigInteger     keyID = new BigInteger(ChordNode.SHA(key));
            NodeInfo       ni    = ChordModule.Instance.NodeInstance.FindSuccessor(keyID);
            ChordNodeProxy obj   = (ChordNodeProxy)Activator.GetObject(typeof(ChordNodeProxy), ni.Address + ":" + ni.Port + "/ChordServices");

            if (obj != null)
            {
                try
                {
                    obj.Remove(keyID, value);
                }
                catch (IOException) { }
                catch (SocketException) { }
            }
        }
Ejemplo n.º 2
0
        public List <string> Get(string key)
        {
            BigInteger     keyID = new BigInteger(ChordNode.SHA(key));
            NodeInfo       ni    = ChordModule.Instance.NodeInstance.FindSuccessor(keyID);
            ChordNodeProxy obj   = (ChordNodeProxy)Activator.GetObject(typeof(ChordNodeProxy), ni.Address + ":" + ni.Port + "/ChordServices");

            if (obj != null)
            {
                try
                {
                    return(obj.Get(keyID));
                }
                catch (IOException) { }
                catch (SocketException) { }
            }
            return(null);
        }
Ejemplo n.º 3
0
        public Server(string id, string address, int port, List<string> knownReplicas, string knownChordAddress, int knownChordPort)
        {
            RemotingConfiguration.Configure("../../../App.config", true);
            IDictionary t = new Hashtable();
            t.Add("timeout", (uint)75000);
            t.Add("port", port);
            TcpChannel channel = new TcpChannel(t, null, null);
            ChannelServices.RegisterChannel(channel, false);

            this.id = id;
            this.address = address;
            this.port = port;
            Exit = false;
            string folderName = address.Split("://".ToCharArray())[3] + "." + port;
            serverDB = new DataBase(folderName, "server.db");
            replicas = new List<string>(knownReplicas);
            serverRequestManager = new ServerRequestManager();
            cn = new ChordNode(address, port, knownChordAddress, knownChordPort);
        }
Ejemplo n.º 4
0
        public Server(string id, string address, int port, List <string> knownReplicas, string knownChordAddress, int knownChordPort)
        {
            RemotingConfiguration.Configure("../../../App.config", true);
            IDictionary t = new Hashtable();

            t.Add("timeout", (uint)75000);
            t.Add("port", port);
            TcpChannel channel = new TcpChannel(t, null, null);

            ChannelServices.RegisterChannel(channel, false);

            this.id      = id;
            this.address = address;
            this.port    = port;
            Exit         = false;
            string folderName = address.Split("://".ToCharArray())[3] + "." + port;

            serverDB             = new DataBase(folderName, "server.db");
            replicas             = new List <string>(knownReplicas);
            serverRequestManager = new ServerRequestManager();
            cn = new ChordNode(address, port, knownChordAddress, knownChordPort);
        }
Ejemplo n.º 5
0
 public void RegisterChordInstance(ChordNode cn)
 {
     nodeInstance = cn;
     nodeInstance.Init();
 }
Ejemplo n.º 6
0
 public void RegisterChordInstance(ChordNode cn)
 {
     nodeInstance = cn;
     nodeInstance.Init();
 }