github.com/stackb/rules_proto@v0.0.0-20240221195024-5428336c51f1/example/routeguide/routeguide.proto (about)

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