Пример #1
0
 def __init__(self, node, host, port, key, commandName="nodes"):
     """
     """
     logger.info("sending %s (findnode) for %s... to %s:%d" 
             % (commandName, ("%x" % key)[:10], host, port)) 
     self.commandName = commandName
     host = getCanonicalIP(host)
     REQUEST.__init__(self, host, port, node)
     Ku = self.node.config.Ku.exportPublicKey()
     url = 'http://'+host+':'+str(port)+'/'+self.commandName+'/'
     url += fencode(key)
     url += '?nodeID='+str(self.node.config.nodeID)
     url += "&Ku_e="+str(Ku['e'])
     url += "&Ku_n="+str(Ku['n'])
     url += '&port='+str(self.node.config.port)
     self.timeoutcount = 0
     self.deferred = defer.Deferred()
     ConnectionQueue.enqueue((self, node, host, port, key, url))
Пример #2
0
 def __init__(self, node, host, port, key, val):
     logger.info("sending kSTORE to %s:%d" % (host, port))
     REQUEST.__init__(self, host, port, node)
     Ku = node.config.Ku.exportPublicKey()
     url = 'http://'+host+':'+str(port)+'/meta/'
     url += fencode(key)+"/"+fencode(val)
     url += '?nodeID='+str(node.config.nodeID)
     url += "&Ku_e="+str(Ku['e'])
     url += "&Ku_n="+str(Ku['n'])
     url += '&port='+str(node.config.port)
     # XXX: instead of a single key/val, protocol will take a series of
     # vals representing the blocks of the coded file and their
     # locations (by nodeID).  The entire thing will be stored under
     # the given key.  Also may need things like signature[s] from 
     # storing node[s], etc.
     #print "in SENDkSTORE.__init__, len(val)=%d" % len(str(val))
     #print "in SENDkSTORE.__init__, len(enc(val))=%d" % len(fencode(val))
     #print "in SENDkSTORE.__init__, len(url)=%d" % len(url)
     self.timeoutcount = 0
     self.deferred = defer.Deferred()
     ConnectionQueue.enqueue((self, host, port, url))