def early_adopter_create_ScannerRPC_server(servicer, port, root_certificates, key_chain_pairs): 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_service_descriptions = { "CheckRunningJob": utilities.unary_unary_service_description( servicer.CheckRunningJob, common.message_pb2.JobList.FromString, common.message_pb2.ResultList.SerializeToString, ), "ConfirmAliveScanner": utilities.unary_unary_service_description( servicer.ConfirmAliveScanner, common.message_pb2.Node.FromString, common.message_pb2.Result.SerializeToString, ), "SendJobList": utilities.unary_unary_service_description( servicer.SendJobList, common.message_pb2.JobList.FromString, common.message_pb2.Result.SerializeToString, ), } return implementations.secure_server(method_service_descriptions, port, root_certificates, key_chain_pairs)
def early_adopter_create_ControllerRPC_server(servicer, port, root_certificates, key_chain_pairs): 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_service_descriptions = { "Heartbeat": utilities.unary_unary_service_description( servicer.Heartbeat, common.message_pb2.Node.FromString, common.message_pb2.Result.SerializeToString, ), "RegisterScanner": utilities.unary_unary_service_description( servicer.RegisterScanner, common.message_pb2.Node.FromString, common.message_pb2.Result.SerializeToString, ), "SendReport": utilities.unary_unary_service_description( servicer.SendReport, common.message_pb2.Report.FromString, common.message_pb2.Result.SerializeToString, ), } return implementations.secure_server(method_service_descriptions, port, root_certificates, key_chain_pairs)
def early_adopter_create_Greeter_server(servicer, port, root_certificates, key_chain_pairs): import helloworld_pb2 import helloworld_pb2 method_service_descriptions = { "SayHello": utilities.unary_unary_service_description( servicer.SayHello, helloworld_pb2.HelloRequest.FromString, helloworld_pb2.HelloReply.SerializeToString, ), } return implementations.secure_server(method_service_descriptions, port, root_certificates, key_chain_pairs)
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), FIB: utilities.unary_stream_service_description(_fib, math_pb2.FibArgs.FromString, math_pb2.Num.SerializeToString), SUM: utilities.stream_unary_service_description(_sum, math_pb2.Num.FromString, math_pb2.Num.SerializeToString), } _TIMEOUT = 3
_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), FIB: utilities.unary_stream_service_description( _fib, math_pb2.FibArgs.FromString, math_pb2.Num.SerializeToString), SUM: utilities.stream_unary_service_description( _sum, math_pb2.Num.FromString, math_pb2.Num.SerializeToString), } _TIMEOUT = 3 class EarlyAdopterImplementationsTest(unittest.TestCase):
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)
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)