Esempio n. 1
0
def method_handlers_generic_handler(service, method_handlers):
    """Creates a grpc.GenericRpcHandler from RpcMethodHandlers.

  Args:
    service: A service name to be used for the given method handlers.
    method_handlers: A dictionary from method name to RpcMethodHandler
      implementing the named method.

  Returns:
    A GenericRpcHandler constructed from the given parameters.
  """
    from grpc import _utilities
    return _utilities.DictionaryGenericHandler(service, method_handlers)
Esempio n. 2
0
def method_handlers_generic_handler(service, method_handlers):
    """Creates a GenericRpcHandler from RpcMethodHandlers.

  Args:
    service: The name of the service that is implemented by the method_handlers.
    method_handlers: A dictionary that maps method names to corresponding
    RpcMethodHandler.

  Returns:
    A GenericRpcHandler. This is typically added to the grpc.Server object
    with add_generic_rpc_handlers() before starting the server.
  """
    from grpc import _utilities  # pylint: disable=cyclic-import
    return _utilities.DictionaryGenericHandler(service, method_handlers)