def early_adopter_create_Greeter_stub(host, port): import helloworld_pb2 import helloworld_pb2 method_invocation_descriptions = { "SayHello": utilities.unary_unary_invocation_description( helloworld_pb2.HelloRequest.SerializeToString, helloworld_pb2.HelloReply.FromString, ), } return implementations.insecure_stub(method_invocation_descriptions, host, port)
def early_adopter_create_ScannerRPC_stub(host, port): import common.message_pb2 import common.message_pb2 import common.message_pb2 import common.message_pb2 import common.message_pb2 import common.message_pb2 method_invocation_descriptions = { "CheckRunningJob": utilities.unary_unary_invocation_description( common.message_pb2.JobList.SerializeToString, common.message_pb2.ResultList.FromString, ), "ConfirmAliveScanner": utilities.unary_unary_invocation_description( common.message_pb2.Node.SerializeToString, common.message_pb2.Result.FromString, ), "SendJobList": utilities.unary_unary_invocation_description( common.message_pb2.JobList.SerializeToString, common.message_pb2.Result.FromString, ), } return implementations.insecure_stub(method_invocation_descriptions, host, port)
def early_adopter_create_ControllerRPC_stub(host, port): import common.message_pb2 import common.message_pb2 import common.message_pb2 import common.message_pb2 import common.message_pb2 import common.message_pb2 method_invocation_descriptions = { "Heartbeat": utilities.unary_unary_invocation_description( common.message_pb2.Node.SerializeToString, common.message_pb2.Result.FromString, ), "RegisterScanner": utilities.unary_unary_invocation_description( common.message_pb2.Node.SerializeToString, common.message_pb2.Result.FromString, ), "SendReport": utilities.unary_unary_invocation_description( common.message_pb2.Report.SerializeToString, common.message_pb2.Result.FromString, ), } return implementations.insecure_stub(method_invocation_descriptions, host, port)
def _fib(request, unused_context): for number in _fibbonacci(request.limit): yield math_pb2.Num(num=number) def _sum(request_iterator, unused_context): accumulation = 0 for request in request_iterator: accumulation += request.num return math_pb2.Num(num=accumulation) _INVOCATION_DESCRIPTIONS = { DIV: utilities.unary_unary_invocation_description( math_pb2.DivArgs.SerializeToString, math_pb2.DivReply.FromString), DIV_MANY: utilities.stream_stream_invocation_description( math_pb2.DivArgs.SerializeToString, math_pb2.DivReply.FromString), FIB: utilities.unary_stream_invocation_description( math_pb2.FibArgs.SerializeToString, math_pb2.Num.FromString), SUM: utilities.stream_unary_invocation_description( math_pb2.Num.SerializeToString, math_pb2.Num.FromString), } _SERVICE_DESCRIPTIONS = { DIV: utilities.unary_unary_service_description( _div, math_pb2.DivArgs.FromString,
def _fib(request, unused_context): for number in _fibbonacci(request.limit): yield math_pb2.Num(num=number) def _sum(request_iterator, unused_context): accumulation = 0 for request in request_iterator: accumulation += request.num return math_pb2.Num(num=accumulation) _INVOCATION_DESCRIPTIONS = { DIV: utilities.unary_unary_invocation_description( math_pb2.DivArgs.SerializeToString, math_pb2.DivReply.FromString), DIV_MANY: utilities.stream_stream_invocation_description( math_pb2.DivArgs.SerializeToString, math_pb2.DivReply.FromString), FIB: utilities.unary_stream_invocation_description( math_pb2.FibArgs.SerializeToString, math_pb2.Num.FromString), SUM: utilities.stream_unary_invocation_description( math_pb2.Num.SerializeToString, math_pb2.Num.FromString), } _SERVICE_DESCRIPTIONS = { DIV: utilities.unary_unary_service_description( _div, math_pb2.DivArgs.FromString, math_pb2.DivReply.SerializeToString), DIV_MANY: utilities.stream_stream_service_description( _div_many, math_pb2.DivArgs.FromString, math_pb2.DivReply.SerializeToString),
import threading from grpc.early_adopter import utilities from interop import empty_pb2 from interop import messages_pb2 _TIMEOUT = 7 def _empty_call(request, unused_context): return empty_pb2.Empty() _CLIENT_EMPTY_CALL = utilities.unary_unary_invocation_description( empty_pb2.Empty.SerializeToString, empty_pb2.Empty.FromString) _SERVER_EMPTY_CALL = utilities.unary_unary_service_description( _empty_call, empty_pb2.Empty.FromString, empty_pb2.Empty.SerializeToString) def _unary_call(request, unused_context): return messages_pb2.SimpleResponse(payload=messages_pb2.Payload( type=messages_pb2.COMPRESSABLE, body=b'\x00' * request.response_size)) _CLIENT_UNARY_CALL = utilities.unary_unary_invocation_description( messages_pb2.SimpleRequest.SerializeToString, messages_pb2.SimpleResponse.FromString) _SERVER_UNARY_CALL = utilities.unary_unary_service_description( _unary_call, messages_pb2.SimpleRequest.FromString, messages_pb2.SimpleResponse.SerializeToString)
import enum import threading from grpc.early_adopter import utilities from interop import empty_pb2 from interop import messages_pb2 _TIMEOUT = 7 def _empty_call(request, unused_context): return empty_pb2.Empty() _CLIENT_EMPTY_CALL = utilities.unary_unary_invocation_description( empty_pb2.Empty.SerializeToString, empty_pb2.Empty.FromString) _SERVER_EMPTY_CALL = utilities.unary_unary_service_description( _empty_call, empty_pb2.Empty.FromString, empty_pb2.Empty.SerializeToString) def _unary_call(request, unused_context): return messages_pb2.SimpleResponse( payload=messages_pb2.Payload( type=messages_pb2.COMPRESSABLE, body=b'\x00' * request.response_size)) _CLIENT_UNARY_CALL = utilities.unary_unary_invocation_description( messages_pb2.SimpleRequest.SerializeToString, messages_pb2.SimpleResponse.FromString) _SERVER_UNARY_CALL = utilities.unary_unary_service_description(