Esempio n. 1
0
 def ExecuteClientServerStream(
         self, request_iter: Iterable[DummyRequest],
         context: grpc.ServicerContext) -> Iterable[DummyResponse]:
     """Stream input to output."""
     for request in request_iter:
         yield DummyResponse(output=self._get_output(request, context))
Esempio n. 2
0
 def ExecuteClientStream(self, request_iter: Iterable[DummyRequest],
                         context: grpc.ServicerContext) -> DummyResponse:
     """Iterate over the input and concatenates the strings into the output."""
     output = "".join(
         self._get_output(request, context) for request in request_iter)
     return DummyResponse(output=output)
Esempio n. 3
0
 def ExecuteServerStream(
         self, request: DummyRequest,
         context: grpc.ServicerContext) -> Iterable[DummyResponse]:
     """Stream one character at a time from the input."""
     for c in self._get_output(request, context):
         yield DummyResponse(output=c)
Esempio n. 4
0
 def Execute(self, request: DummyRequest,
             context: grpc.ServicerContext) -> DummyResponse:
     """Echo the input, or take on of the special cases actions."""
     return DummyResponse(output=self._get_output(request, context))