1# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! 2import grpc 3 4import route_guide_pb2 as route__guide__pb2 5 6 7class RouteGuideStub(object): 8 """Interface exported by the server. 9 """ 10 11 def __init__(self, channel): 12 """Constructor. 13 14 Args: 15 channel: A grpc.Channel. 16 """ 17 self.GetFeature = channel.unary_unary( 18 '/routeguide.RouteGuide/GetFeature', 19 request_serializer=route__guide__pb2.Point.SerializeToString, 20 response_deserializer=route__guide__pb2.Feature.FromString, 21 ) 22 self.ListFeatures = channel.unary_stream( 23 '/routeguide.RouteGuide/ListFeatures', 24 request_serializer=route__guide__pb2.Rectangle.SerializeToString, 25 response_deserializer=route__guide__pb2.Feature.FromString, 26 ) 27 self.RecordRoute = channel.stream_unary( 28 '/routeguide.RouteGuide/RecordRoute', 29 request_serializer=route__guide__pb2.Point.SerializeToString, 30 response_deserializer=route__guide__pb2.RouteSummary.FromString, 31 ) 32 self.RouteChat = channel.stream_stream( 33 '/routeguide.RouteGuide/RouteChat', 34 request_serializer=route__guide__pb2.RouteNote.SerializeToString, 35 response_deserializer=route__guide__pb2.RouteNote.FromString, 36 ) 37 38 39class RouteGuideServicer(object): 40 """Interface exported by the server. 41 """ 42 43 def GetFeature(self, request, context): 44 """A simple RPC. 45 46 Obtains the feature at a given position. 47 48 A feature with an empty name is returned if there's no feature at the given 49 position. 50 """ 51 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 52 context.set_details('Method not implemented!') 53 raise NotImplementedError('Method not implemented!') 54 55 def ListFeatures(self, request, context): 56 """A server-to-client streaming RPC. 57 58 Obtains the Features available within the given Rectangle. Results are 59 streamed rather than returned at once (e.g. in a response message with a 60 repeated field), as the rectangle may cover a large area and contain a 61 huge number of features. 62 """ 63 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 64 context.set_details('Method not implemented!') 65 raise NotImplementedError('Method not implemented!') 66 67 def RecordRoute(self, request_iterator, context): 68 """A client-to-server streaming RPC. 69 70 Accepts a stream of Points on a route being traversed, returning a 71 RouteSummary when traversal is completed. 72 """ 73 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 74 context.set_details('Method not implemented!') 75 raise NotImplementedError('Method not implemented!') 76 77 def RouteChat(self, request_iterator, context): 78 """A Bidirectional streaming RPC. 79 80 Accepts a stream of RouteNotes sent while a route is being traversed, 81 while receiving other RouteNotes (e.g. from other users). 82 """ 83 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 84 context.set_details('Method not implemented!') 85 raise NotImplementedError('Method not implemented!') 86 87 88def add_RouteGuideServicer_to_server(servicer, server): 89 rpc_method_handlers = { 90 'GetFeature': grpc.unary_unary_rpc_method_handler( 91 servicer.GetFeature, 92 request_deserializer=route__guide__pb2.Point.FromString, 93 response_serializer=route__guide__pb2.Feature.SerializeToString, 94 ), 95 'ListFeatures': grpc.unary_stream_rpc_method_handler( 96 servicer.ListFeatures, 97 request_deserializer=route__guide__pb2.Rectangle.FromString, 98 response_serializer=route__guide__pb2.Feature.SerializeToString, 99 ), 100 'RecordRoute': grpc.stream_unary_rpc_method_handler( 101 servicer.RecordRoute, 102 request_deserializer=route__guide__pb2.Point.FromString, 103 response_serializer=route__guide__pb2.RouteSummary.SerializeToString, 104 ), 105 'RouteChat': grpc.stream_stream_rpc_method_handler( 106 servicer.RouteChat, 107 request_deserializer=route__guide__pb2.RouteNote.FromString, 108 response_serializer=route__guide__pb2.RouteNote.SerializeToString, 109 ), 110 } 111 generic_handler = grpc.method_handlers_generic_handler( 112 'routeguide.RouteGuide', rpc_method_handlers) 113 server.add_generic_rpc_handlers((generic_handler,)) 114