Esempio n. 1
0
 def put(self, alias, gpid, hash):
   (ideal_id, ideal_loc) = self.overlay.get(hash)
   if self.overlay.id == ideal_id:
     self.names[alias] = gpid
     vis.store_name(alias, gpid, self.overlay.here)
   else:
     network_locator = rpc.RPCConnector(ideal_loc)
     locator = network_locator.connect()
     locator.put_gpid_by_name(alias, hash, gpid)
     locator.disconnect()
Esempio n. 2
0
 def create_named_singleton(self, alias, suggested_loc, actor_info, hash):
     (ideal_id, ideal_loc) = self.overlay.get(hash)
     if self.overlay.id == ideal_id:
      self.clever_lock_get(alias)
      exists = (alias in self.names)
      if exists:
        self.clever_lock_release(alias)
        return (self.names[alias], exists)
      else:
        network_locator = rpc.RPCConnector(suggested_loc)
        locator = network_locator.connect()
        gpid = locator.create_actor(*actor_info)
        locator.disconnect()
        self.names[alias] = gpid
        self.clever_lock_release(alias)
        vis.store_name(alias, gpid, self.overlay.here)
     else:
       network_locator = rpc.RPCConnector(ideal_loc)
       locator = network_locator.connect()
       (gpid, exists) = locator.create_named_singleton(alias, suggested_loc, actor_info, hash)
       locator.disconnect()
     return (gpid, exists)