コード例 #1
0
ファイル: nickname_holder.py プロジェクト: hack-bitdust/devel
 def doDHTWriteKey(self, arg):
     """
     Action method.
     """
     d = dht_service.set_value(self.key, my_id.getLocalID(), age=int(time.time()))
     d.addCallback(self._dht_write_result)
     d.addErrback(lambda x: self.automat('dht-write-failed'))
コード例 #2
0
 def doDHTWriteKey(self, arg):
     """
     Action method.
     """
     d = dht_service.set_value(self.key, my_id.getLocalID(), age=int(time.time()))
     d.addCallback(self._dht_write_result)
     d.addErrback(lambda x: self.automat('dht-write-failed'))
コード例 #3
0
 def do_write(self):
     if _Debug:
         lg.out(_DebugLevel, 'dht_relations.do_write %s' % self._index)
     new_payload = json.dumps(self._new_data)
     d = dht_service.set_value(make_dht_key(self.customer_idurl, self._index, self._prefix), new_payload, age=int(time.time()))
     d.addCallback(self.do_report_success)
     d.addErrback(self.do_report_failed)
     return 2
コード例 #4
0
ファイル: udp_node.py プロジェクト: vesellov/bitdust.devel
 def doDHTWtiteMyAddress(self, arg):
     """
     Action method.
     """
     d = dht_service.set_value(
         self.my_id + ':address', '%s:%d' %
         (self.my_address[0], self.my_address[1]))
     d.addCallback(self._wrote_my_address)
     d.addErrback(lambda x: self.automat('dht-write-failed'))
コード例 #5
0
 def doDHTWtiteMyAddress(self, arg):
     """
     Action method.
     """
     d = dht_service.set_value(
         self.my_id + ':address',
         '%s:%d' % (self.my_address[0], self.my_address[1]),
         age=int(time.time()),
     )
     d.addCallback(self._wrote_my_address)
     d.addErrback(lambda x: self.automat('dht-write-failed'))
コード例 #6
0
def write_to_dht():
    """

    """
    lg.out(6, "propagate.write_to_dht")
    LocalIdentity = my_id.getLocalIdentity()
    return dht_service.set_value(
        LocalIdentity.getIDURL(),
        LocalIdentity.serialize(),
        age=int(time.time()),
    )
コード例 #7
0
 def doDHTWriteIncoming(self, arg):
     """
     Action method.
     """
     key = self.peer_id + ':incoming' + str(self.KeyPosition)
     value = '%s %s:%d %s\n' % (str(self.my_id), self.my_address[
         0], self.my_address[1], str(time.time()))
     if _Debug:
         lg.out(_DebugLevel, 'doDHTWriteIncoming  key=%s' % key)
     self.working_deferred = dht_service.set_value(key, value)
     self.working_deferred.addCallback(self._wrote_peer_incoming)
     self.working_deferred.addErrback(
         lambda x: self.automat('dht-write-failed'))
コード例 #8
0
ファイル: udp_connector.py プロジェクト: hack-bitdust/devel
 def doDHTWriteIncoming(self, arg):
     """
     Action method.
     """
     key = self.peer_id + ':incoming' + str(self.KeyPosition)
     value = '%s %s:%d %s\n' % (str(self.my_id), self.my_address[0],
                                self.my_address[1], str(time.time()))
     if _Debug:
         lg.out(_DebugLevel, 'doDHTWriteIncoming  key=%s' % key)
     self.working_deferred = dht_service.set_value(key,
                                                   value,
                                                   age=int(time.time()))
     self.working_deferred.addCallback(self._wrote_peer_incoming)
     self.working_deferred.addErrback(
         lambda x: self.automat('dht-write-failed'))