mirror of
https://github.com/unclechu/gRPC-haskell.git
synced 2024-12-26 11:49:44 +01:00
ce56953b24
* initial echo client/server examples * registered and unregistered versions of the example client * ignore pyc files * cpp echo code, flag to build examples * threaded server example
118 lines
4 KiB
Python
118 lines
4 KiB
Python
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
# source: echo.proto
|
|
|
|
import sys
|
|
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
|
|
from google.protobuf import descriptor as _descriptor
|
|
from google.protobuf import message as _message
|
|
from google.protobuf import reflection as _reflection
|
|
from google.protobuf import symbol_database as _symbol_database
|
|
from google.protobuf import descriptor_pb2
|
|
# @@protoc_insertion_point(imports)
|
|
|
|
_sym_db = _symbol_database.Default()
|
|
|
|
|
|
|
|
|
|
DESCRIPTOR = _descriptor.FileDescriptor(
|
|
name='echo.proto',
|
|
package='echo',
|
|
syntax='proto3',
|
|
serialized_pb=_b('\n\necho.proto\x12\x04\x65\x63ho\"\x1e\n\x0b\x45\x63hoRequest\x12\x0f\n\x07message\x18\x01 \x01(\t28\n\x04\x45\x63ho\x12\x30\n\x06\x44oEcho\x12\x11.echo.EchoRequest\x1a\x11.echo.EchoRequest\"\x00\x62\x06proto3')
|
|
)
|
|
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
|
|
|
|
|
|
|
|
|
_ECHOREQUEST = _descriptor.Descriptor(
|
|
name='EchoRequest',
|
|
full_name='echo.EchoRequest',
|
|
filename=None,
|
|
file=DESCRIPTOR,
|
|
containing_type=None,
|
|
fields=[
|
|
_descriptor.FieldDescriptor(
|
|
name='message', full_name='echo.EchoRequest.message', index=0,
|
|
number=1, type=9, cpp_type=9, label=1,
|
|
has_default_value=False, default_value=_b("").decode('utf-8'),
|
|
message_type=None, enum_type=None, containing_type=None,
|
|
is_extension=False, extension_scope=None,
|
|
options=None),
|
|
],
|
|
extensions=[
|
|
],
|
|
nested_types=[],
|
|
enum_types=[
|
|
],
|
|
options=None,
|
|
is_extendable=False,
|
|
syntax='proto3',
|
|
extension_ranges=[],
|
|
oneofs=[
|
|
],
|
|
serialized_start=20,
|
|
serialized_end=50,
|
|
)
|
|
|
|
DESCRIPTOR.message_types_by_name['EchoRequest'] = _ECHOREQUEST
|
|
|
|
EchoRequest = _reflection.GeneratedProtocolMessageType('EchoRequest', (_message.Message,), dict(
|
|
DESCRIPTOR = _ECHOREQUEST,
|
|
__module__ = 'echo_pb2'
|
|
# @@protoc_insertion_point(class_scope:echo.EchoRequest)
|
|
))
|
|
_sym_db.RegisterMessage(EchoRequest)
|
|
|
|
|
|
import abc
|
|
from grpc.beta import implementations as beta_implementations
|
|
from grpc.framework.common import cardinality
|
|
from grpc.framework.interfaces.face import utilities as face_utilities
|
|
|
|
class BetaEchoServicer(object):
|
|
"""<fill me in later!>"""
|
|
__metaclass__ = abc.ABCMeta
|
|
@abc.abstractmethod
|
|
def DoEcho(self, request, context):
|
|
raise NotImplementedError()
|
|
|
|
class BetaEchoStub(object):
|
|
"""The interface to which stubs will conform."""
|
|
__metaclass__ = abc.ABCMeta
|
|
@abc.abstractmethod
|
|
def DoEcho(self, request, timeout):
|
|
raise NotImplementedError()
|
|
DoEcho.future = None
|
|
|
|
def beta_create_Echo_server(servicer, pool=None, pool_size=None, default_timeout=None, maximum_timeout=None):
|
|
import echo_pb2
|
|
import echo_pb2
|
|
request_deserializers = {
|
|
('echo.Echo', 'DoEcho'): echo_pb2.EchoRequest.FromString,
|
|
}
|
|
response_serializers = {
|
|
('echo.Echo', 'DoEcho'): echo_pb2.EchoRequest.SerializeToString,
|
|
}
|
|
method_implementations = {
|
|
('echo.Echo', 'DoEcho'): face_utilities.unary_unary_inline(servicer.DoEcho),
|
|
}
|
|
server_options = beta_implementations.server_options(request_deserializers=request_deserializers, response_serializers=response_serializers, thread_pool=pool, thread_pool_size=pool_size, default_timeout=default_timeout, maximum_timeout=maximum_timeout)
|
|
return beta_implementations.server(method_implementations, options=server_options)
|
|
|
|
def beta_create_Echo_stub(channel, host=None, metadata_transformer=None, pool=None, pool_size=None):
|
|
import echo_pb2
|
|
import echo_pb2
|
|
request_serializers = {
|
|
('echo.Echo', 'DoEcho'): echo_pb2.EchoRequest.SerializeToString,
|
|
}
|
|
response_deserializers = {
|
|
('echo.Echo', 'DoEcho'): echo_pb2.EchoRequest.FromString,
|
|
}
|
|
cardinalities = {
|
|
'DoEcho': cardinality.Cardinality.UNARY_UNARY,
|
|
}
|
|
stub_options = beta_implementations.stub_options(host=host, metadata_transformer=metadata_transformer, request_serializers=request_serializers, response_deserializers=response_deserializers, thread_pool=pool, thread_pool_size=pool_size)
|
|
return beta_implementations.dynamic_stub(channel, 'echo.Echo', cardinalities, options=stub_options)
|
|
# @@protoc_insertion_point(module_scope)
|