Exemple #1
0
    def __init__(self,
                 host,
                 port,
                 pool,
                 request_serializers,
                 response_deserializers,
                 secure,
                 root_certificates,
                 private_key,
                 certificate_chain,
                 metadata_transformer=None,
                 server_host_override=None):
        """Constructor.

    Args:
      host: The host to which to connect for RPC service.
      port: The port to which to connect for RPC service.
      pool: A thread pool.
      request_serializers: A dict from RPC method names to request object
        serializer behaviors.
      response_deserializers: A dict from RPC method names to response object
        deserializer behaviors.
      secure: A boolean indicating whether or not to use a secure connection.
      root_certificates: The PEM-encoded root certificates or None to ask for
        them to be retrieved from a default location.
      private_key: The PEM-encoded private key to use or None if no private
        key should be used.
      certificate_chain: The PEM-encoded certificate chain to use or None if
        no certificate chain should be used.
      metadata_transformer: A function that given a metadata object produces
        another metadata to be used in the underlying communication on the
        wire.
      server_host_override: (For testing only) the target name used for SSL
        host name checking.
    """
        self._condition = threading.Condition()
        self._host = host
        self._port = port
        self._pool = pool
        self._request_serializers = request_serializers
        self._response_deserializers = response_deserializers

        self._fore_link = null.NULL_FORE_LINK
        self._completion_queue = None
        self._channel = None
        self._rpc_states = {}
        self._spinning = False
        if secure:
            self._client_credentials = _low.ClientCredentials(
                root_certificates, private_key, certificate_chain)
        else:
            self._client_credentials = None
        self._root_certificates = root_certificates
        self._private_key = private_key
        self._certificate_chain = certificate_chain
        self._metadata_transformer = metadata_transformer
        self._server_host_override = server_host_override
Exemple #2
0
    def __init__(self, host, port, pool, request_serializers,
                 response_deserializers, secure, root_certificates,
                 private_key, certificate_chain):
        """Constructor.

    Args:
      host: The host to which to connect for RPC service.
      port: The port to which to connect for RPC service.
      pool: A thread pool.
      request_serializers: A dict from RPC method names to request object
        serializer behaviors.
      response_deserializers: A dict from RPC method names to response object
        deserializer behaviors.
      secure: A boolean indicating whether or not to use a secure connection.
      root_certificates: The PEM-encoded root certificates or None to ask for
        them to be retrieved from a default location.
      private_key: The PEM-encoded private key to use or None if no private
        key should be used.
      certificate_chain: The PEM-encoded certificate chain to use or None if
        no certificate chain should be used.
    """
        self._condition = threading.Condition()
        self._host = host
        self._port = port
        self._pool = pool
        self._request_serializers = request_serializers
        self._response_deserializers = response_deserializers

        self._fore_link = null.NULL_FORE_LINK
        self._completion_queue = None
        self._channel = None
        self._rpc_states = {}
        self._spinning = False
        if secure:
            self._client_credentials = _low.ClientCredentials(
                root_certificates, private_key, certificate_chain)
        else:
            self._client_credentials = None
        self._root_certificates = root_certificates
        self._private_key = private_key
        self._certificate_chain = certificate_chain