def incoming_actor(self, actorstate): # Create actor but don't start # TODO: FIX- generation of id, handle local and non-local migrations. log.debug(self, 'receieved migrating actor %s' % actorstate) actor = Actor(local_theatre()) actor.state = actorstate old_actor_id = actor.state.actor_id type = actor.state.actortype if ids.ip(old_actor_id) == ids.ip_from_loc(self.here): # Migration has been local actor_id = ids.change_port(old_actor_id, ids.port_from_loc(self.here)) else: actor_id = ids.change_host(old_actor_id, self.here, self.shared_data.next_id_num()) actor.state.actor_id = actor_id self.__local_actor_store.add_network_actor(actor, actor_id) actor.start() # At the moment even core migrations trigger re-registrations # Could probably forgo these if core migrations are frequent. local_theatre().globally_reregister_network_actor(actor_id, type, old_actor_id) names = actor.state.names for name in names: local_theatre().name(name, actor_id)
def attach(self, name, at): if self.name is None: self.name = name if ids.ip(self.actor_id) != ids.ip_from_loc(at): migrate_to(at)
def add_actor(self, id): ip = ids.ip(id) self.nodes[ip].add_actor(id) self.draw()