Merge pull request #610 from nathanielmanistaatgoogle/early-adopter-split

pull/616/head
Nathaniel Manista 10 years ago
commit a75e4efe23
  1. 79
      src/python/interop/interop/methods.py
  2. 17
      src/python/interop/interop/server.py
  3. 107
      src/python/src/grpc/early_adopter/_face_utilities.py
  4. 10
      src/python/src/grpc/early_adopter/implementations.py
  5. 41
      src/python/src/grpc/early_adopter/interfaces.py
  6. 150
      src/python/src/grpc/early_adopter/utilities.py

@ -37,9 +37,11 @@ from interop import messages_pb2
def _empty_call(request):
return empty_pb2.Empty()
EMPTY_CALL = utilities.unary_unary_rpc_method(
_empty_call, empty_pb2.Empty.SerializeToString, empty_pb2.Empty.FromString,
_CLIENT_EMPTY_CALL = utilities.unary_unary_client_rpc_method(
empty_pb2.Empty.SerializeToString, empty_pb2.Empty.FromString)
_SERVER_EMPTY_CALL = utilities.unary_unary_server_rpc_method(
_empty_call, empty_pb2.Empty.FromString,
empty_pb2.Empty.SerializeToString)
def _unary_call(request):
@ -48,11 +50,12 @@ def _unary_call(request):
type=messages_pb2.COMPRESSABLE,
body=b'\x00' * request.response_size))
UNARY_CALL = utilities.unary_unary_rpc_method(
_unary_call, messages_pb2.SimpleRequest.SerializeToString,
messages_pb2.SimpleRequest.FromString,
messages_pb2.SimpleResponse.SerializeToString,
_CLIENT_UNARY_CALL = utilities.unary_unary_client_rpc_method(
messages_pb2.SimpleRequest.SerializeToString,
messages_pb2.SimpleResponse.FromString)
_SERVER_UNARY_CALL = utilities.unary_unary_server_rpc_method(
_unary_call, messages_pb2.SimpleRequest.FromString,
messages_pb2.SimpleResponse.SerializeToString)
def _streaming_output_call(request):
@ -62,12 +65,13 @@ def _streaming_output_call(request):
type=request.response_type,
body=b'\x00' * response_parameters.size))
STREAMING_OUTPUT_CALL = utilities.unary_stream_rpc_method(
_streaming_output_call,
_CLIENT_STREAMING_OUTPUT_CALL = utilities.unary_stream_client_rpc_method(
messages_pb2.StreamingOutputCallRequest.SerializeToString,
messages_pb2.StreamingOutputCallRequest.FromString,
messages_pb2.StreamingOutputCallResponse.SerializeToString,
messages_pb2.StreamingOutputCallResponse.FromString)
_SERVER_STREAMING_OUTPUT_CALL = utilities.unary_stream_server_rpc_method(
_streaming_output_call,
messages_pb2.StreamingOutputCallRequest.FromString,
messages_pb2.StreamingOutputCallResponse.SerializeToString)
def _streaming_input_call(request_iterator):
@ -78,12 +82,13 @@ def _streaming_input_call(request_iterator):
return messages_pb2.StreamingInputCallResponse(
aggregated_payload_size=aggregate_size)
STREAMING_INPUT_CALL = utilities.stream_unary_rpc_method(
_streaming_input_call,
_CLIENT_STREAMING_INPUT_CALL = utilities.stream_unary_client_rpc_method(
messages_pb2.StreamingInputCallRequest.SerializeToString,
messages_pb2.StreamingInputCallRequest.FromString,
messages_pb2.StreamingInputCallResponse.SerializeToString,
messages_pb2.StreamingInputCallResponse.FromString)
_SERVER_STREAMING_INPUT_CALL = utilities.stream_unary_server_rpc_method(
_streaming_input_call,
messages_pb2.StreamingInputCallRequest.FromString,
messages_pb2.StreamingInputCallResponse.SerializeToString)
def _full_duplex_call(request_iterator):
@ -93,17 +98,47 @@ def _full_duplex_call(request_iterator):
type=request.payload.type,
body=b'\x00' * request.response_parameters[0].size))
FULL_DUPLEX_CALL = utilities.stream_stream_rpc_method(
_full_duplex_call,
_CLIENT_FULL_DUPLEX_CALL = utilities.stream_stream_client_rpc_method(
messages_pb2.StreamingOutputCallRequest.SerializeToString,
messages_pb2.StreamingOutputCallRequest.FromString,
messages_pb2.StreamingOutputCallResponse.SerializeToString,
messages_pb2.StreamingOutputCallResponse.FromString)
_SERVER_FULL_DUPLEX_CALL = utilities.stream_stream_server_rpc_method(
_full_duplex_call,
messages_pb2.StreamingOutputCallRequest.FromString,
messages_pb2.StreamingOutputCallResponse.SerializeToString)
# NOTE(nathaniel): Apparently this is the same as the full-duplex call?
HALF_DUPLEX_CALL = utilities.stream_stream_rpc_method(
_full_duplex_call,
_CLIENT_HALF_DUPLEX_CALL = utilities.stream_stream_client_rpc_method(
messages_pb2.StreamingOutputCallRequest.SerializeToString,
messages_pb2.StreamingOutputCallRequest.FromString,
messages_pb2.StreamingOutputCallResponse.SerializeToString,
messages_pb2.StreamingOutputCallResponse.FromString)
_SERVER_HALF_DUPLEX_CALL = utilities.stream_stream_server_rpc_method(
_full_duplex_call,
messages_pb2.StreamingOutputCallRequest.FromString,
messages_pb2.StreamingOutputCallResponse.SerializeToString)
_SERVICE_NAME = '/grpc.testing.TestService'
EMPTY_CALL_METHOD_NAME = _SERVICE_NAME + '/EmptyCall'
UNARY_CALL_METHOD_NAME = _SERVICE_NAME + '/UnaryCall'
STREAMING_OUTPUT_CALL_METHOD_NAME = _SERVICE_NAME + '/StreamingOutputCall'
STREAMING_INPUT_CALL_METHOD_NAME = _SERVICE_NAME + '/StreamingInputCall'
FULL_DUPLEX_CALL_METHOD_NAME = _SERVICE_NAME + '/FullDuplexCall'
HALF_DUPLEX_CALL_METHOD_NAME = _SERVICE_NAME + '/HalfDuplexCall'
CLIENT_METHODS = {
EMPTY_CALL_METHOD_NAME: _CLIENT_EMPTY_CALL,
UNARY_CALL_METHOD_NAME: _CLIENT_UNARY_CALL,
STREAMING_OUTPUT_CALL_METHOD_NAME: _CLIENT_STREAMING_OUTPUT_CALL,
STREAMING_INPUT_CALL_METHOD_NAME: _CLIENT_STREAMING_INPUT_CALL,
FULL_DUPLEX_CALL_METHOD_NAME: _CLIENT_FULL_DUPLEX_CALL,
HALF_DUPLEX_CALL_METHOD_NAME: _CLIENT_HALF_DUPLEX_CALL,
}
SERVER_METHODS = {
EMPTY_CALL_METHOD_NAME: _SERVER_EMPTY_CALL,
UNARY_CALL_METHOD_NAME: _SERVER_UNARY_CALL,
STREAMING_OUTPUT_CALL_METHOD_NAME: _SERVER_STREAMING_OUTPUT_CALL,
STREAMING_INPUT_CALL_METHOD_NAME: _SERVER_STREAMING_INPUT_CALL,
FULL_DUPLEX_CALL_METHOD_NAME: _SERVER_FULL_DUPLEX_CALL,
HALF_DUPLEX_CALL_METHOD_NAME: _SERVER_HALF_DUPLEX_CALL,
}

@ -43,19 +43,6 @@ _ONE_DAY_IN_SECONDS = 60 * 60 * 24
_PRIVATE_KEY_RESOURCE_PATH = 'credentials/server1.key'
_CERTIFICATE_CHAIN_RESOURCE_PATH = 'credentials/server1.pem'
_METHODS = {
'/grpc.testing.TestService/EmptyCall': methods.EMPTY_CALL,
'/grpc.testing.TestService/UnaryCall': methods.UNARY_CALL,
'/grpc.testing.TestService/StreamingOutputCall':
methods.STREAMING_OUTPUT_CALL,
'/grpc.testing.TestService/StreamingInputCall':
methods.STREAMING_INPUT_CALL,
'/grpc.testing.TestService/FullDuplexCall':
methods.FULL_DUPLEX_CALL,
'/grpc.testing.TestService/HalfDuplexCall':
methods.HALF_DUPLEX_CALL,
}
def serve():
parser = argparse.ArgumentParser()
@ -72,10 +59,10 @@ def serve():
certificate_chain = pkg_resources.resource_string(
__name__, _CERTIFICATE_CHAIN_RESOURCE_PATH)
server = implementations.secure_server(
_METHODS, args.port, private_key, certificate_chain)
methods.SERVER_METHODS, args.port, private_key, certificate_chain)
else:
server = implementations.insecure_server(
_METHODS, args.port)
methods.SERVER_METHODS, args.port)
server.start()
logging.info('Server serving.')

@ -37,8 +37,8 @@ from grpc.early_adopter import interfaces
class _InlineUnaryUnaryMethod(face_interfaces.InlineValueInValueOutMethod):
def __init__(self, unary_unary_rpc_method):
self._method = unary_unary_rpc_method
def __init__(self, unary_unary_server_rpc_method):
self._method = unary_unary_server_rpc_method
def service(self, request, context):
"""See face_interfaces.InlineValueInValueOutMethod.service for spec."""
@ -47,8 +47,8 @@ class _InlineUnaryUnaryMethod(face_interfaces.InlineValueInValueOutMethod):
class _InlineUnaryStreamMethod(face_interfaces.InlineValueInStreamOutMethod):
def __init__(self, unary_stream_rpc_method):
self._method = unary_stream_rpc_method
def __init__(self, unary_stream_server_rpc_method):
self._method = unary_stream_server_rpc_method
def service(self, request, context):
"""See face_interfaces.InlineValueInStreamOutMethod.service for spec."""
@ -57,8 +57,8 @@ class _InlineUnaryStreamMethod(face_interfaces.InlineValueInStreamOutMethod):
class _InlineStreamUnaryMethod(face_interfaces.InlineStreamInValueOutMethod):
def __init__(self, stream_unary_rpc_method):
self._method = stream_unary_rpc_method
def __init__(self, stream_unary_server_rpc_method):
self._method = stream_unary_server_rpc_method
def service(self, request_iterator, context):
"""See face_interfaces.InlineStreamInValueOutMethod.service for spec."""
@ -67,61 +67,99 @@ class _InlineStreamUnaryMethod(face_interfaces.InlineStreamInValueOutMethod):
class _InlineStreamStreamMethod(face_interfaces.InlineStreamInStreamOutMethod):
def __init__(self, stream_stream_rpc_method):
self._method = stream_stream_rpc_method
def __init__(self, stream_stream_server_rpc_method):
self._method = stream_stream_server_rpc_method
def service(self, request_iterator, context):
"""See face_interfaces.InlineStreamInStreamOutMethod.service for spec."""
return self._method.service_stream_stream(request_iterator)
class Breakdown(object):
class ClientBreakdown(object):
"""An intermediate representation of invocation-side views of RPC methods.
Attributes:
request_serializers: A dictionary from RPC method name to callable
behavior to be used serializing request values for the RPC.
response_deserializers: A dictionary from RPC method name to callable
behavior to be used deserializing response values for the RPC.
"""
__metaclass__ = abc.ABCMeta
class _EasyClientBreakdown(
ClientBreakdown,
collections.namedtuple(
'_EasyClientBreakdown',
('request_serializers', 'response_deserializers'))):
pass
class ServerBreakdown(object):
"""An intermediate representation of implementations of RPC methods.
Attributes:
unary_unary_methods:
unary_stream_methods:
stream_unary_methods:
stream_stream_methods:
request_serializers:
request_deserializers:
response_serializers:
response_deserializers:
unary_unary_methods: A dictionary from RPC method name to callable
behavior implementing the RPC method for unary-unary RPC methods.
unary_stream_methods: A dictionary from RPC method name to callable
behavior implementing the RPC method for unary-stream RPC methods.
stream_unary_methods: A dictionary from RPC method name to callable
behavior implementing the RPC method for stream-unary RPC methods.
stream_stream_methods: A dictionary from RPC method name to callable
behavior implementing the RPC method for stream-stream RPC methods.
request_deserializers: A dictionary from RPC method name to callable
behavior to be used deserializing request values for the RPC.
response_serializers: A dictionary from RPC method name to callable
behavior to be used serializing response values for the RPC.
"""
__metaclass__ = abc.ABCMeta
class _EasyBreakdown(
Breakdown,
class _EasyServerBreakdown(
ServerBreakdown,
collections.namedtuple(
'_EasyBreakdown',
['unary_unary_methods', 'unary_stream_methods', 'stream_unary_methods',
'stream_stream_methods', 'request_serializers',
'request_deserializers', 'response_serializers',
'response_deserializers'])):
'_EasyServerBreakdown',
('unary_unary_methods', 'unary_stream_methods', 'stream_unary_methods',
'stream_stream_methods', 'request_deserializers',
'response_serializers'))):
pass
def break_down(methods):
"""Breaks down RPC methods.
def client_break_down(methods):
"""Derives a ClientBreakdown from several interfaces.ClientRpcMethods.
Args:
methods: A dictionary from RPC mthod name to
interfaces.ClientRpcMethod object describing the RPCs.
Returns:
A ClientBreakdown corresponding to the given methods.
"""
request_serializers = {}
response_deserializers = {}
for name, method in methods.iteritems():
request_serializers[name] = method.serialize_request
response_deserializers[name] = method.deserialize_response
return _EasyClientBreakdown(request_serializers, response_deserializers)
def server_break_down(methods):
"""Derives a ServerBreakdown from several interfaces.ServerRpcMethods.
Args:
methods: A dictionary from RPC mthod name to
interfaces.RpcMethod object describing the RPCs.
interfaces.ServerRpcMethod object describing the RPCs.
Returns:
A Breakdown corresponding to the given methods.
A ServerBreakdown corresponding to the given methods.
"""
unary_unary = {}
unary_stream = {}
stream_unary = {}
stream_stream = {}
request_serializers = {}
request_deserializers = {}
response_serializers = {}
response_deserializers = {}
for name, method in methods.iteritems():
cardinality = method.cardinality()
if cardinality is interfaces.Cardinality.UNARY_UNARY:
@ -132,12 +170,9 @@ def break_down(methods):
stream_unary[name] = _InlineStreamUnaryMethod(method)
elif cardinality is interfaces.Cardinality.STREAM_STREAM:
stream_stream[name] = _InlineStreamStreamMethod(method)
request_serializers[name] = method.serialize_request
request_deserializers[name] = method.deserialize_request
response_serializers[name] = method.serialize_response
response_deserializers[name] = method.deserialize_response
return _EasyBreakdown(
return _EasyServerBreakdown(
unary_unary, unary_stream, stream_unary, stream_stream,
request_serializers, request_deserializers, response_serializers,
response_deserializers)
request_deserializers, response_serializers)

@ -92,7 +92,7 @@ class _Server(interfaces.Server):
def _build_server(methods, port, private_key, certificate_chain):
breakdown = _face_utilities.break_down(methods)
breakdown = _face_utilities.server_break_down(methods)
return _Server(breakdown, port, private_key, certificate_chain)
@ -101,8 +101,8 @@ def insecure_server(methods, port):
Args:
methods: A dictionary from RPC method name to
interfaces.RpcMethod object describing the RPCs to be
serviced by the created server.
interfaces.ServerRpcMethod object describing the RPCs to
be serviced by the created server.
port: The port on which to serve.
Returns:
@ -117,8 +117,8 @@ def secure_server(methods, port, private_key, certificate_chain):
Args:
methods: A dictionary from RPC method name to
interfaces.RpcMethod object describing the RPCs to be
serviced by the created server.
interfaces.ServerRpcMethod object describing the RPCs to
be serviced by the created server.
port: The port on which to serve.
private_key: A pem-encoded private key.
certificate_chain: A pem-encoded certificate chain.

@ -44,7 +44,7 @@ class Cardinality(enum.Enum):
class RpcMethod(object):
"""A sum type for the implementation of an RPC method."""
"""A type for the common aspects of RPC method specifications."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
@ -59,6 +59,11 @@ class RpcMethod(object):
"""
raise NotImplementedError()
class ClientRpcMethod(RpcMethod):
"""Invocation-side description of an RPC method."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def serialize_request(self, request):
"""Serializes a request value.
@ -72,6 +77,25 @@ class RpcMethod(object):
"""
raise NotImplementedError()
@abc.abstractmethod
def deserialize_response(self, serialized_response):
"""Deserializes a response value.
Args:
serialized_response: A bytestring that is the
serialization of a response value appropriate for this
RpcMethod.
Returns:
A response value corresponding to the given bytestring.
"""
raise NotImplementedError()
class ServerRpcMethod(RpcMethod):
"""Service-side description of an RPC method."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def deserialize_request(self, serialized_request):
"""Deserializes a request value.
@ -99,20 +123,6 @@ class RpcMethod(object):
"""
raise NotImplementedError()
@abc.abstractmethod
def deserialize_response(self, serialized_response):
"""Deserializes a response value.
Args:
serialized_response: A bytestring that is the
serialization of a response value appropriate for this
RpcMethod.
Returns:
A response value corresponding to the given bytestring.
"""
raise NotImplementedError()
@abc.abstractmethod
def service_unary_unary(self, request):
"""Carries out this RPC.
@ -182,7 +192,6 @@ class Server(object):
"""A GRPC Server."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def start(self):
"""Instructs this server to commence service of RPCs."""

@ -32,7 +32,7 @@
from grpc.early_adopter import interfaces
class _RpcMethod(interfaces.RpcMethod):
class _RpcMethod(interfaces.ClientRpcMethod, interfaces.ServerRpcMethod):
def __init__(
self, cardinality, unary_unary, unary_stream, stream_unary,
@ -85,129 +85,181 @@ class _RpcMethod(interfaces.RpcMethod):
return self._stream_stream(request_iterator)
def unary_unary_rpc_method(
behavior, request_serializer, request_deserializer, response_serializer,
response_deserializer):
"""Constructs an interfaces.RpcMethod for the given behavior.
def unary_unary_client_rpc_method(request_serializer, response_deserializer):
"""Constructs an interfaces.ClientRpcMethod for a unary-unary RPC method.
Args:
request_serializer: A callable that when called on a request
value returns a bytestring corresponding to that value.
response_deserializer: A callable that when called on a
bytestring returns the response value corresponding to
that bytestring.
Returns:
An interfaces.ClientRpcMethod constructed from the given
arguments representing a unary-request/unary-response RPC
method.
"""
return _RpcMethod(
interfaces.Cardinality.UNARY_UNARY, None, None, None, None,
request_serializer, None, None, response_deserializer)
def unary_stream_client_rpc_method(request_serializer, response_deserializer):
"""Constructs an interfaces.ClientRpcMethod for a unary-stream RPC method.
Args:
request_serializer: A callable that when called on a request
value returns a bytestring corresponding to that value.
response_deserializer: A callable that when called on a
bytestring returns the response value corresponding to
that bytestring.
Returns:
An interfaces.ClientRpcMethod constructed from the given
arguments representing a unary-request/streaming-response
RPC method.
"""
return _RpcMethod(
interfaces.Cardinality.UNARY_STREAM, None, None, None, None,
request_serializer, None, None, response_deserializer)
def stream_unary_client_rpc_method(request_serializer, response_deserializer):
"""Constructs an interfaces.ClientRpcMethod for a stream-unary RPC method.
Args:
request_serializer: A callable that when called on a request
value returns a bytestring corresponding to that value.
response_deserializer: A callable that when called on a
bytestring returns the response value corresponding to
that bytestring.
Returns:
An interfaces.ClientRpcMethod constructed from the given
arguments representing a streaming-request/unary-response
RPC method.
"""
return _RpcMethod(
interfaces.Cardinality.STREAM_UNARY, None, None, None, None,
request_serializer, None, None, response_deserializer)
def stream_stream_client_rpc_method(request_serializer, response_deserializer):
"""Constructs an interfaces.ClientRpcMethod for a stream-stream RPC method.
Args:
request_serializer: A callable that when called on a request
value returns a bytestring corresponding to that value.
response_deserializer: A callable that when called on a
bytestring returns the response value corresponding to
that bytestring.
Returns:
An interfaces.ClientRpcMethod constructed from the given
arguments representing a
streaming-request/streaming-response RPC method.
"""
return _RpcMethod(
interfaces.Cardinality.STREAM_STREAM, None, None, None, None,
request_serializer, None, None, response_deserializer)
def unary_unary_server_rpc_method(
behavior, request_deserializer, response_serializer):
"""Constructs an interfaces.ServerRpcMethod for the given behavior.
Args:
behavior: A callable that implements a unary-unary RPC
method that accepts a single request and returns a single
response.
request_serializer: A callable that when called on a request
value returns a bytestring corresponding to that value.
request_deserializer: A callable that when called on a
bytestring returns the request value corresponding to that
bytestring.
response_serializer: A callable that when called on a
response value returns the bytestring corresponding to
that value.
response_deserializer: A callable that when called on a
bytestring returns the response value corresponding to
that bytestring.
Returns:
An interfaces.RpcMethod constructed from the given
An interfaces.ServerRpcMethod constructed from the given
arguments representing a unary-request/unary-response RPC
method.
"""
return _RpcMethod(
interfaces.Cardinality.UNARY_UNARY, behavior, None, None, None,
request_serializer, request_deserializer, response_serializer,
response_deserializer)
None, request_deserializer, response_serializer, None)
def unary_stream_rpc_method(
behavior, request_serializer, request_deserializer, response_serializer,
response_deserializer):
"""Constructs an interfaces.RpcMethod for the given behavior.
def unary_stream_server_rpc_method(
behavior, request_deserializer, response_serializer):
"""Constructs an interfaces.ServerRpcMethod for the given behavior.
Args:
behavior: A callable that implements a unary-stream RPC
method that accepts a single request and returns an
iterator of zero or more responses.
request_serializer: A callable that when called on a request
value returns a bytestring corresponding to that value.
request_deserializer: A callable that when called on a
bytestring returns the request value corresponding to that
bytestring.
response_serializer: A callable that when called on a
response value returns the bytestring corresponding to
that value.
response_deserializer: A callable that when called on a
bytestring returns the response value corresponding to
that bytestring.
Returns:
An interfaces.RpcMethod constructed from the given
An interfaces.ServerRpcMethod constructed from the given
arguments representing a unary-request/streaming-response
RPC method.
"""
return _RpcMethod(
interfaces.Cardinality.UNARY_STREAM, None, behavior, None, None,
request_serializer, request_deserializer, response_serializer,
response_deserializer)
None, request_deserializer, response_serializer, None)
def stream_unary_rpc_method(
behavior, request_serializer, request_deserializer, response_serializer,
response_deserializer):
"""Constructs an interfaces.RpcMethod for the given behavior.
def stream_unary_server_rpc_method(
behavior, request_deserializer, response_serializer):
"""Constructs an interfaces.ServerRpcMethod for the given behavior.
Args:
behavior: A callable that implements a stream-unary RPC
method that accepts an iterator of zero or more requests
and returns a single response.
request_serializer: A callable that when called on a request
value returns a bytestring corresponding to that value.
request_deserializer: A callable that when called on a
bytestring returns the request value corresponding to that
bytestring.
response_serializer: A callable that when called on a
response value returns the bytestring corresponding to
that value.
response_deserializer: A callable that when called on a
bytestring returns the response value corresponding to
that bytestring.
Returns:
An interfaces.RpcMethod constructed from the given
An interfaces.ServerRpcMethod constructed from the given
arguments representing a streaming-request/unary-response
RPC method.
"""
return _RpcMethod(
interfaces.Cardinality.STREAM_UNARY, None, None, behavior, None,
request_serializer, request_deserializer, response_serializer,
response_deserializer)
None, request_deserializer, response_serializer, None)
def stream_stream_rpc_method(
behavior, request_serializer, request_deserializer, response_serializer,
response_deserializer):
"""Constructs an interfaces.RpcMethod for the given behavior.
def stream_stream_server_rpc_method(
behavior, request_deserializer, response_serializer):
"""Constructs an interfaces.ServerRpcMethod for the given behavior.
Args:
behavior: A callable that implements a stream-stream RPC
method that accepts an iterator of zero or more requests
and returns an iterator of zero or more responses.
request_serializer: A callable that when called on a request
value returns a bytestring corresponding to that value.
request_deserializer: A callable that when called on a
bytestring returns the request value corresponding to that
bytestring.
response_serializer: A callable that when called on a
response value returns the bytestring corresponding to
that value.
response_deserializer: A callable that when called on a
bytestring returns the response value corresponding to
that bytestring.
Returns:
An interfaces.RpcMethod constructed from the given
An interfaces.ServerRpcMethod constructed from the given
arguments representing a
streaming-request/streaming-response RPC method.
"""
return _RpcMethod(
interfaces.Cardinality.STREAM_STREAM, None, None, None, behavior,
request_serializer, request_deserializer, response_serializer,
response_deserializer)
None, request_deserializer, response_serializer, None)

Loading…
Cancel
Save