1 // Copyright 2015 The gRPC Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 syntax = "proto3"; 15 16 option java_multiple_files = true; 17 option java_package = "io.grpc.routeguideexample"; 18 option java_outer_classname = "RouteGuideProto"; 19 option objc_class_prefix = "RTG"; 20 21 package routeguide; 22 23 // Interface exported by the server. 24 service RouteGuide { 25 // A simple RPC. 26 // 27 // Obtains the feature at a given position. 28 // 29 // A feature with an empty name is returned if there's no feature at the given 30 // position. 31 rpc GetFeature(Point) returns (Feature) {} 32 33 // A server-to-client streaming RPC. 34 // 35 // Obtains the Features available within the given Rectangle. Results are 36 // streamed rather than returned at once (e.g. in a response message with a 37 // repeated field), as the rectangle may cover a large area and contain a 38 // huge number of features. 39 rpc ListFeatures(Rectangle) returns (stream Feature) {} 40 41 // A client-to-server streaming RPC. 42 // 43 // Accepts a stream of Points on a route being traversed, returning a 44 // RouteSummary when traversal is completed. 45 rpc RecordRoute(stream Point) returns (RouteSummary) {} 46 47 // A Bidirectional streaming RPC. 48 // 49 // Accepts a stream of RouteNotes sent while a route is being traversed, 50 // while receiving other RouteNotes (e.g. from other users). 51 rpc RouteChat(stream RouteNote) returns (stream RouteNote) {} 52 } 53 54 // Points are represented as latitude-longitude pairs in the E7 representation 55 // (degrees multiplied by 10**7 and rounded to the nearest integer). 56 // Latitudes should be in the range +/- 90 degrees and longitude should be in 57 // the range +/- 180 degrees (inclusive). 58 message Point { 59 int32 latitude = 1; 60 int32 longitude = 2; 61 } 62 63 // A latitude-longitude rectangle, represented as two diagonally opposite 64 // points "lo" and "hi". 65 message Rectangle { 66 // One corner of the rectangle. 67 Point lo = 1; 68 69 // The other corner of the rectangle. 70 Point hi = 2; 71 } 72 73 // A feature names something at a given point. 74 // 75 // If a feature could not be named, the name is empty. 76 message Feature { 77 // The name of the feature. 78 string name = 1; 79 80 // The point where the feature is detected. 81 Point location = 2; 82 } 83 84 // Not used in the RPC. Instead, this is here for the form serialized to disk. 85 message FeatureDatabase { 86 repeated Feature feature = 1; 87 } 88 89 // A RouteNote is a message sent while at a given point. 90 message RouteNote { 91 // The location from which the message is sent. 92 Point location = 1; 93 94 // The message to be sent. 95 string message = 2; 96 } 97 98 // A RouteSummary is received in response to a RecordRoute rpc. 99 // 100 // It contains the number of individual points received, the number of 101 // detected features, and the total distance covered as the cumulative sum of 102 // the distance between each point. 103 message RouteSummary { 104 // The number of points received. 105 int32 point_count = 1; 106 107 // The number of known features passed while traversing the route. 108 int32 feature_count = 2; 109 110 // The distance covered in metres. 111 int32 distance = 3; 112 113 // The duration of the traversal in seconds. 114 int32 elapsed_time = 4; 115 } 116