Example #1
0
        public void SaveNode(DHTNode node)
        {
            if (!IsConnected)
            {
                throw new DatabaseException("Database disconnected");
            }

            var record = new DBNode()
            {
                node_id  = node.Id.ToString(),
                endpoint = node.EndPoint.ToString()
            };

            fConnection.InsertOrReplace(record);
        }
Example #2
0
 public static Ice.DispatchStatus slaveDisconnected___(DHTNode obj__, IceInternal.Incoming inS__, Ice.Current current__)
 {
     checkMode__(Ice.OperationMode.Normal, current__.mode);
     IceInternal.BasicStream is__ = inS__.istr();
     is__.startReadEncaps();
     string id;
     id = is__.readString();
     IDHT.range[] newRanges;
     {
         int szx__ = is__.readSize();
         is__.checkFixedSeq(szx__, 8);
         newRanges = new IDHT.range[szx__];
         for(int ix__ = 0; ix__ < szx__; ++ix__)
         {
             newRanges[ix__].read__(is__);
         }
     }
     IDHT.nodeConf[] childRanges;
     {
         int szx__ = is__.readSize();
         is__.startSeq(szx__, 11);
         childRanges = new IDHT.nodeConf[szx__];
         for(int ix__ = 0; ix__ < szx__; ++ix__)
         {
             childRanges[ix__] = new IDHT.nodeConf();
             childRanges[ix__].read__(is__);
             is__.checkSeq();
             is__.endElement();
         }
         is__.endSeq(szx__);
     }
     is__.endReadEncaps();
     obj__.slaveDisconnected(id, newRanges, childRanges, current__);
     return Ice.DispatchStatus.DispatchOK;
 }
Example #3
0
 public static Ice.DispatchStatus newConnected___(DHTNode obj__, IceInternal.Incoming inS__, Ice.Current current__)
 {
     checkMode__(Ice.OperationMode.Normal, current__.mode);
     IceInternal.BasicStream is__ = inS__.istr();
     is__.startReadEncaps();
     string id;
     id = is__.readString();
     is__.endReadEncaps();
     IceInternal.BasicStream os__ = inS__.ostr();
     IDHT.nodeConf ret__ = obj__.newConnected(id, current__);
     if(ret__ == null)
     {
         IDHT.nodeConf tmp__ = new IDHT.nodeConf();
         tmp__.write__(os__);
     }
     else
     {
         ret__.write__(os__);
     }
     return Ice.DispatchStatus.DispatchOK;
 }
Example #4
0
 public static Ice.DispatchStatus searchDHT___(DHTNode obj__, IceInternal.Incoming inS__, Ice.Current current__)
 {
     checkMode__(Ice.OperationMode.Normal, current__.mode);
     IceInternal.BasicStream is__ = inS__.istr();
     is__.startReadEncaps();
     string key;
     key = is__.readString();
     is__.endReadEncaps();
     IceInternal.BasicStream os__ = inS__.ostr();
     string ret__ = obj__.searchDHT(key, current__);
     os__.writeString(ret__);
     return Ice.DispatchStatus.DispatchOK;
 }
 // TODO: implement periodic clearing of the cache of nodes from outdated information
 public void SaveNode(DHTNode node)
 {
     fDatabase.SaveNode(node);
 }