def __init__(self, ring_id=1, id=None, ip='127.0.0.1', port=8080, user_id=None): MessageHandlerNode.__init__(self, ip, port) self.set_timeout(0.25) self.id = id if id != None else random_key() sys.stdout.write('me: %s\n' % key_to_int(self.id)) self.ring_id = ring_id self.user_id = user_id self.contacts = MultiRingChordContacts( Contact(ring_id=ring_id, id=self.id, ip=self.ip, port=self.port, network_protocol=self)) self.messages_received = 0 self.message_limit = None # self.data[string_to_key('physical_key')] = { # 'data': value, # 'version': VectorVersion(), # 'requires': VectorVersionList() # } self.data = {} self.callback_manager = CallbackManager() self.next_finger_to_fix = 1
def __init__(self, ring_id=1, id=None, ip='127.0.0.1', port=8080, user_id=None): MessageHandlerNode.__init__(self, ip, port) self.set_timeout(0.25) self.id = id if id != None else random_key() sys.stdout.write('me: %s\n' % key_to_int(self.id)) self.ring_id = ring_id self.user_id = user_id self.contacts = MultiRingChordContacts(Contact(ring_id=ring_id, id=self.id, ip=self.ip, port=self.port, network_protocol=self)) self.messages_received = 0 self.message_limit = None # self.data[string_to_key('physical_key')] = { # 'data': value, # 'version': VectorVersion(), # 'requires': VectorVersionList() # } self.data = {} self.callback_manager = CallbackManager() self.next_finger_to_fix = 1
def __init__(self, ip=LOCALHOST, port=None): MessageHandlerNode.__init__(self, ip, port) self.nodes_by_ring = {}
def received_obj(self, ip, port, obj): if isinstance(obj, DirectoryServerMessage): MessageHandlerNode.received_obj(self, ip, port, obj) else: DHTNode.received_obj(self, ip, port, obj)