__copyright__ = "Copyright (c) 2020 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"

# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc

from . import jina_pb2 as jina__pb2


class JinaRPCStub(object):
  """*
  jina gRPC service.
  """

  def __init__(self, channel):
    """Constructor.

    Args:
      channel: A grpc.Channel.
    """
    self.Call = channel.stream_stream(
        '/jina.JinaRPC/Call',
        request_serializer=jina__pb2.Request.SerializeToString,
        response_deserializer=jina__pb2.Request.FromString,
        )
    self.CallUnary = channel.unary_unary(
        '/jina.JinaRPC/CallUnary',
        request_serializer=jina__pb2.Request.SerializeToString,
        response_deserializer=jina__pb2.Request.FromString,
        )
    self.Spawn = channel.unary_stream(
        '/jina.JinaRPC/Spawn',
        request_serializer=jina__pb2.SpawnRequest.SerializeToString,
        response_deserializer=jina__pb2.SpawnRequest.FromString,
        )


class JinaRPCServicer(object):
  """*
  jina gRPC service.
  """

  def Call(self, request_iterator, context):
    """Pass in a Request and a filled Request with matches will be returned.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def CallUnary(self, request, context):
    # missing associated documentation comment in .proto file
    pass
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def Spawn(self, request, context):
    """Pass in a Request and a filled Request will be returned.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')


def add_JinaRPCServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'Call': grpc.stream_stream_rpc_method_handler(
          servicer.Call,
          request_deserializer=jina__pb2.Request.FromString,
          response_serializer=jina__pb2.Request.SerializeToString,
      ),
      'CallUnary': grpc.unary_unary_rpc_method_handler(
          servicer.CallUnary,
          request_deserializer=jina__pb2.Request.FromString,
          response_serializer=jina__pb2.Request.SerializeToString,
      ),
      'Spawn': grpc.unary_stream_rpc_method_handler(
          servicer.Spawn,
          request_deserializer=jina__pb2.SpawnRequest.FromString,
          response_serializer=jina__pb2.SpawnRequest.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'jina.JinaRPC', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,))
