OLD | NEW |
(Empty) | |
| 1 // Copyright 2015, Google Inc. |
| 2 // All rights reserved. |
| 3 // |
| 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are |
| 6 // met: |
| 7 // |
| 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above |
| 11 // copyright notice, this list of conditions and the following disclaimer |
| 12 // in the documentation and/or other materials provided with the |
| 13 // distribution. |
| 14 // * Neither the name of Google Inc. nor the names of its |
| 15 // contributors may be used to endorse or promote products derived from |
| 16 // this software without specific prior written permission. |
| 17 // |
| 18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 |
| 30 syntax = "proto2"; |
| 31 |
| 32 option java_package = "io.grpc.examples"; |
| 33 |
| 34 package routeguide; |
| 35 |
| 36 // Interface exported by the server. |
| 37 service RouteGuide { |
| 38 // A simple RPC. |
| 39 // |
| 40 // Obtains the feature at a given position. |
| 41 rpc GetFeature(Point) returns (Feature) {} |
| 42 |
| 43 // A server-to-client streaming RPC. |
| 44 // |
| 45 // Obtains the Features available within the given Rectangle. Results are |
| 46 // streamed rather than returned at once (e.g. in a response message with a |
| 47 // repeated field), as the rectangle may cover a large area and contain a |
| 48 // huge number of features. |
| 49 rpc ListFeatures(Rectangle) returns (stream Feature) {} |
| 50 |
| 51 // A client-to-server streaming RPC. |
| 52 // |
| 53 // Accepts a stream of Points on a route being traversed, returning a |
| 54 // RouteSummary when traversal is completed. |
| 55 rpc RecordRoute(stream Point) returns (RouteSummary) {} |
| 56 |
| 57 // A Bidirectional streaming RPC. |
| 58 // |
| 59 // Accepts a stream of RouteNotes sent while a route is being traversed, |
| 60 // while receiving other RouteNotes (e.g. from other users). |
| 61 rpc RouteChat(stream RouteNote) returns (stream RouteNote) {} |
| 62 } |
| 63 |
| 64 // Points are represented as latitude-longitude pairs in the E7 representation |
| 65 // (degrees multiplied by 10**7 and rounded to the nearest integer). |
| 66 // Latitudes should be in the range +/- 90 degrees and longitude should be in |
| 67 // the range +/- 180 degrees (inclusive). |
| 68 message Point { |
| 69 optional int32 latitude = 1 [default = 0]; |
| 70 optional int32 longitude = 2 [default = 0]; |
| 71 } |
| 72 |
| 73 // A latitude-longitude rectangle, represented as two diagonally opposite |
| 74 // points "lo" and "hi". |
| 75 message Rectangle { |
| 76 // One corner of the rectangle. |
| 77 optional Point lo = 1; |
| 78 |
| 79 // The other corner of the rectangle. |
| 80 optional Point hi = 2; |
| 81 } |
| 82 |
| 83 // A feature names something at a given point. |
| 84 // |
| 85 // If a feature could not be named, the name is empty. |
| 86 message Feature { |
| 87 // The name of the feature. |
| 88 optional string name = 1; |
| 89 |
| 90 // The point where the feature is detected. |
| 91 optional Point location = 2; |
| 92 } |
| 93 |
| 94 // A RouteNote is a message sent while at a given point. |
| 95 message RouteNote { |
| 96 // The location from which the message is sent. |
| 97 optional Point location = 1; |
| 98 |
| 99 // The message to be sent. |
| 100 optional string message = 2; |
| 101 } |
| 102 |
| 103 // A RouteSummary is received in response to a RecordRoute rpc. |
| 104 // |
| 105 // It contains the number of individual points received, the number of |
| 106 // detected features, and the total distance covered as the cumulative sum of |
| 107 // the distance between each point. |
| 108 message RouteSummary { |
| 109 // The number of points received. |
| 110 optional int32 point_count = 1 [default = 0]; |
| 111 |
| 112 // The number of known features passed while traversing the route. |
| 113 optional int32 feature_count = 2 [default = 0]; |
| 114 |
| 115 // The distance covered in metres. |
| 116 optional int32 distance = 3 [default = 0]; |
| 117 |
| 118 // The duration of the traversal in seconds. |
| 119 optional int32 elapsed_time = 4 [default = 0]; |
| 120 } |
OLD | NEW |