def setup(self, config, cache_dir):
self.config = config
self.port = config['PORT']
- self.store = DB(os.path.join(cache_dir, '.khashmir.' + str(self.port) + '.db'))
+ self.store = DB(os.path.join(cache_dir, 'khashmir.' + str(self.port) + '.db'))
self.node = self._loadSelfNode('', self.port)
self.table = KTable(self.node, config)
#self.app = service.Application("krpc")
n = self.Node(id, _krpc_sender[0], _krpc_sender[1])
self.insertNode(n, contacted=0)
nodes = self.table.findNodes(target)
- nodes = map(lambda node: node.senderDict(), nodes)
+ nodes = map(lambda node: node.contactInfo(), nodes)
return {"nodes" : nodes, "id" : self.node.id}
return {'values' : l, "id": self.node.id}
else:
nodes = self.table.findNodes(key)
- nodes = map(lambda node: node.senderDict(), nodes)
+ nodes = map(lambda node: node.contactInfo(), nodes)
return {'nodes' : nodes, "id": self.node.id}
### provides a generic write method, you probably don't want to deploy something that allows
_Node = KNodeWrite
## async, callback indicates nodes we got a response from (but no guarantee they didn't drop it on the floor)
def storeValueForKey(self, key, value, callback=None):
- """ stores the value for key in the global table, returns immediately, no status
+ """ stores the value and origination time for key in the global table, returns immediately, no status
in this implementation, peers respond but don't indicate status to storing values
a key can have many values
"""