twisted.internet.endpoints.UNIXClientEndpoint - python examples

Here are the examples of the python api twisted.internet.endpoints.UNIXClientEndpoint taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

5 Examples 7

3 View Complete Implementation : memcachepool.py
Copyright Apache License 2.0
Author : apple
def installPools(pools, maxClients=5, reactor=None):
    if reactor is None:
        from twisted.internet import reactor
    for name, pool in pools.items():
        if pool["ClientEnabled"]:
            if pool.get("MemcacheSocket"):
                ep = UNIXClientEndpoint(reactor, pool["MemcacheSocket"])
            else:
                ep = GAIEndpoint(reactor, pool["BindAddress"], pool["Port"])

            _installPool(
                name,
                pool["HandleCacheTypes"],
                ep,
                maxClients,
                reactor,
            )

3 View Complete Implementation : ipc.py
Copyright GNU Affero General Public License v3.0
Author : maas
    def __init__(self, reactor, socket_path=None):
        super(IPCWorkerService, self).__init__()
        self.reactor = reactor
        self.socket_path = socket_path
        if self.socket_path is None:
            self.socket_path = get_ipc_socket_path()
        self.endpoint = UNIXClientEndpoint(reactor, self.socket_path)
        self._protocol = None
        self.protocol = DeferredValue()
        self.processId = DeferredValue()

0 View Complete Implementation : test_hpe_plugin.py
Copyright Apache License 2.0
Author : hpe-storage
    def endpointForURI(self, uri):
        return UNIXClientEndpoint(self.reactor, hpe_sock_path)

0 View Complete Implementation : fixtures.py
Copyright GNU Affero General Public License v3.0
Author : maas
    @asynchronous
    @defer.inlineCallbacks
    def addCluster(self, protocol, rack_controller):
        """Add a new stub cluster using the given `protocol`.

        The `protocol` should be an instance of `amp.AMP`.

        :return: A `Deferred` that fires with the connected protocol
            instance.
        """
        endpoint = endpoints.UNIXClientEndpoint(reactor, self.sockfile)
        protocol = yield endpoints.connectProtocol(endpoint, protocol)

        # Mock the registration into the database, as the rack controller is
        # already created. We reset this once registration is complete so as
        # to not interfere with other tests.
        registered = rack_controller
        patcher = MonkeyPatcher()
        patcher.add_patch(
            rackcontrollers, "register", (lambda *args, **kwargs: registered)
        )

        # Register the rack controller with the region.
        patcher.patch()
        try:
            yield protocol.callRemote(
                region.RegisterRackController,
                system_id=rack_controller.system_id,
                hostname=rack_controller.hostname,
                interfaces={},
                url=urlparse(""),
            )
        finally:
            patcher.restore()

        defer.returnValue(protocol)

0 View Complete Implementation : test_unix.py
Copyright MIT License
Author : wistbean
    def client(self, reactor, serverAddress):
        """
        Construct a UNIX client endpoint.
        """
        return UNIXClientEndpoint(reactor, serverAddress.name)