コード例 #1
0
    def attach_master(self, name, type=None, opts={}):
        bopts = _broker.MapBackendOptions(
        )  # Generator expression doesn't work here.
        for (k, v) in opts.items():
            bopts[k] = Data.from_py(v)

        s = _broker.Endpoint.attach_master(self, name, type, bopts)
        return Store(s.get()) if s.is_valid() else None
コード例 #2
0
    def attach_master(self, name, type=None, opts={}):
        bopts = _broker.MapBackendOptions(
        )  # Generator expression doesn't work here.
        for (k, v) in opts.items():
            bopts[k] = Data.from_py(v)

        s = _broker.Endpoint.attach_master(self, name, type, bopts)
        if not s.is_valid():
            return None
        result = Store(s.get())
        # This extra reference establishes a parent-child relation between the
        # two Python objects, making sure that the garbage collector destroys
        # the store *before* cleaning up the endpoint
        result._parent = self
        return result