Esempio n. 1
0
 async def StreamingOutputCall(
         self, request: messages_pb2.StreamingOutputCallRequest,
         unused_context):
     for response_parameters in request.response_parameters:
         if response_parameters.interval_us != 0:
             await asyncio.sleep(
                 datetime.timedelta(microseconds=response_parameters.
                                    interval_us).total_seconds())
         if response_parameters.size != 0:
             yield messages_pb2.StreamingOutputCallResponse(
                 payload=messages_pb2.Payload(type=request.response_type,
                                              body=b'\x00' *
                                              response_parameters.size))
         else:
             yield messages_pb2.StreamingOutputCallResponse()
Esempio n. 2
0
 def StreamingOutputCall(self, request, context):
     _maybe_echo_status_and_message(request, context)
     for response_parameters in request.response_parameters:
         yield messages_pb2.StreamingOutputCallResponse(
             payload=messages_pb2.Payload(type=request.response_type,
                                          body=b'\x00' *
                                          response_parameters.size))
Esempio n. 3
0
 async def FullDuplexCall(self, request_async_iterator, context):
     await _maybe_echo_metadata(context)
     async for request in request_async_iterator:
         await _maybe_echo_status(request, context)
         for response_parameters in request.response_parameters:
             if response_parameters.interval_us != 0:
                 await asyncio.sleep(
                     datetime.timedelta(microseconds=response_parameters.
                                        interval_us).total_seconds())
             if response_parameters.size != 0:
                 yield messages_pb2.StreamingOutputCallResponse(
                     payload=messages_pb2.Payload(type=request.payload.type,
                                                  body=b'\x00' *
                                                  response_parameters.size))
             else:
                 yield messages_pb2.StreamingOutputCallResponse()
Esempio n. 4
0
 def FullDuplexCall(self, request_iterator, context):
     for request in request_iterator:
         for response_parameters in request.response_parameters:
             yield messages_pb2.StreamingOutputCallResponse(
                 payload=messages_pb2.Payload(type=request.payload.type,
                                              body=b'\x00' *
                                              response_parameters.size))
Esempio n. 5
0
 def FullDuplexCall(self, request_iterator, context):
     _maybe_echo_metadata(context)
     for request in request_iterator:
         _maybe_echo_status_and_message(request, context)
         for response_parameters in request.response_parameters:
             yield messages_pb2.StreamingOutputCallResponse(
                 payload=messages_pb2.Payload(type=request.payload.type,
                                              body=b'\x00' *
                                              response_parameters.size))
Esempio n. 6
0
 def StreamingOutputCall(self, request, context):
     _maybe_echo_status_and_message(request, context)
     for response_parameters in request.response_parameters:
         if response_parameters.interval_us != 0:
             time.sleep(response_parameters.interval_us / _US_IN_A_SECOND)
         yield messages_pb2.StreamingOutputCallResponse(
             payload=messages_pb2.Payload(type=request.response_type,
                                          body=b'\x00' *
                                          response_parameters.size))
Esempio n. 7
0
 def StreamingOutputCall(self, request, context):
     if request.HasField('response_status'):
         context.set_code(request.response_status.code)
         context.set_details(request.response_status.message)
     for response_parameters in request.response_parameters:
         yield messages_pb2.StreamingOutputCallResponse(
             payload=messages_pb2.Payload(type=request.response_type,
                                          body=b'\x00' *
                                          response_parameters.size))
Esempio n. 8
0
 def FullDuplexCall(self, request_iterator, context):
     for request in request_iterator:
         if request.HasField('response_status'):
             context.code(request.response_status.code)
             context.details(request.response_status.message)
         for response_parameters in request.response_parameters:
             yield messages_pb2.StreamingOutputCallResponse(
                 payload=messages_pb2.Payload(type=request.payload.type,
                                              body=b'\x00' *
                                              response_parameters.size))
Esempio n. 9
0
 async def FullDuplexCall(self, request_async_iterator, unused_context):
     async for request in request_async_iterator:
         for response_parameters in request.response_parameters:
             if response_parameters.interval_us != 0:
                 await asyncio.sleep(
                     datetime.timedelta(microseconds=response_parameters.
                                        interval_us).total_seconds())
             yield messages_pb2.StreamingOutputCallResponse(
                 payload=messages_pb2.Payload(type=request.payload.type,
                                              body=b'\x00' *
                                              response_parameters.size))