Craig Tiller | ad1fd3a | 2015-02-16 12:23:04 -0800 | [diff] [blame] | 1 | |
| 2 | // Copyright 2015, Google Inc. |
| 3 | // All rights reserved. |
Craig Tiller | ce5021b | 2015-02-18 09:25:21 -0800 | [diff] [blame] | 4 | // |
Craig Tiller | ad1fd3a | 2015-02-16 12:23:04 -0800 | [diff] [blame] | 5 | // Redistribution and use in source and binary forms, with or without |
| 6 | // modification, are permitted provided that the following conditions are |
| 7 | // met: |
Craig Tiller | ce5021b | 2015-02-18 09:25:21 -0800 | [diff] [blame] | 8 | // |
Craig Tiller | ad1fd3a | 2015-02-16 12:23:04 -0800 | [diff] [blame] | 9 | // * Redistributions of source code must retain the above copyright |
| 10 | // notice, this list of conditions and the following disclaimer. |
| 11 | // * Redistributions in binary form must reproduce the above |
| 12 | // copyright notice, this list of conditions and the following disclaimer |
| 13 | // in the documentation and/or other materials provided with the |
| 14 | // distribution. |
| 15 | // * Neither the name of Google Inc. nor the names of its |
| 16 | // contributors may be used to endorse or promote products derived from |
| 17 | // this software without specific prior written permission. |
Craig Tiller | ce5021b | 2015-02-18 09:25:21 -0800 | [diff] [blame] | 18 | // |
Craig Tiller | ad1fd3a | 2015-02-16 12:23:04 -0800 | [diff] [blame] | 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | |
chenw | a8fd44a | 2014-12-10 15:13:55 -0800 | [diff] [blame] | 31 | // Message definitions to be used by integration test service definitions. |
| 32 | |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 33 | syntax = "proto3"; |
chenw | a8fd44a | 2014-12-10 15:13:55 -0800 | [diff] [blame] | 34 | |
| 35 | package grpc.testing; |
| 36 | |
| 37 | // The type of payload that should be returned. |
| 38 | enum PayloadType { |
| 39 | // Compressable text format. |
| 40 | COMPRESSABLE = 0; |
| 41 | |
| 42 | // Uncompressable binary format. |
| 43 | UNCOMPRESSABLE = 1; |
| 44 | |
| 45 | // Randomly chosen from all other formats defined in this enum. |
| 46 | RANDOM = 2; |
| 47 | } |
| 48 | |
Abhishek Kumar | 905a65b | 2015-06-19 15:28:07 -0700 | [diff] [blame] | 49 | // Compression algorithms |
| 50 | enum CompressionType { |
| 51 | // No compression |
| 52 | NONE = 0; |
| 53 | GZIP = 1; |
| 54 | DEFLATE = 2; |
| 55 | } |
| 56 | |
chenw | a8fd44a | 2014-12-10 15:13:55 -0800 | [diff] [blame] | 57 | // A block of data, to simply increase gRPC message size. |
| 58 | message Payload { |
| 59 | // The type of data in body. |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 60 | PayloadType type = 1; |
chenw | a8fd44a | 2014-12-10 15:13:55 -0800 | [diff] [blame] | 61 | // Primary contents of payload. |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 62 | bytes body = 2; |
chenw | a8fd44a | 2014-12-10 15:13:55 -0800 | [diff] [blame] | 63 | } |
| 64 | |
Abhishek Kumar | 905a65b | 2015-06-19 15:28:07 -0700 | [diff] [blame] | 65 | // A protobuf representation for grpc status. This is used by test |
| 66 | // clients to specify a status that the server should attempt to return. |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 67 | message EchoStatus { |
| 68 | int32 code = 1; |
| 69 | string message = 2; |
Abhishek Kumar | 905a65b | 2015-06-19 15:28:07 -0700 | [diff] [blame] | 70 | } |
| 71 | |
chenw | a8fd44a | 2014-12-10 15:13:55 -0800 | [diff] [blame] | 72 | // Unary request. |
| 73 | message SimpleRequest { |
| 74 | // Desired payload type in the response from the server. |
| 75 | // If response_type is RANDOM, server randomly chooses one from other formats. |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 76 | PayloadType response_type = 1; |
chenw | a8fd44a | 2014-12-10 15:13:55 -0800 | [diff] [blame] | 77 | |
| 78 | // Desired payload size in the response from the server. |
| 79 | // If response_type is COMPRESSABLE, this denotes the size before compression. |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 80 | int32 response_size = 2; |
chenw | a8fd44a | 2014-12-10 15:13:55 -0800 | [diff] [blame] | 81 | |
| 82 | // Optional input payload sent along with the request. |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 83 | Payload payload = 3; |
Yang Gao | 94e97ef | 2015-01-25 22:33:54 -0800 | [diff] [blame] | 84 | |
| 85 | // Whether SimpleResponse should include username. |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 86 | bool fill_username = 4; |
Yang Gao | 94e97ef | 2015-01-25 22:33:54 -0800 | [diff] [blame] | 87 | |
| 88 | // Whether SimpleResponse should include OAuth scope. |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 89 | bool fill_oauth_scope = 5; |
Abhishek Kumar | 905a65b | 2015-06-19 15:28:07 -0700 | [diff] [blame] | 90 | |
| 91 | // Compression algorithm to be used by the server for the response (stream) |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 92 | CompressionType response_compression = 6; |
Abhishek Kumar | 905a65b | 2015-06-19 15:28:07 -0700 | [diff] [blame] | 93 | |
| 94 | // Whether server should return a given status |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 95 | EchoStatus response_status = 7; |
chenw | a8fd44a | 2014-12-10 15:13:55 -0800 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | // Unary response, as configured by the request. |
| 99 | message SimpleResponse { |
| 100 | // Payload to increase message size. |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 101 | Payload payload = 1; |
chenw | a8fd44a | 2014-12-10 15:13:55 -0800 | [diff] [blame] | 102 | // The user the request came from, for verifying authentication was |
| 103 | // successful when the client expected it. |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 104 | string username = 2; |
Yang Gao | 94e97ef | 2015-01-25 22:33:54 -0800 | [diff] [blame] | 105 | // OAuth scope. |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 106 | string oauth_scope = 3; |
chenw | a8fd44a | 2014-12-10 15:13:55 -0800 | [diff] [blame] | 107 | } |
| 108 | |
| 109 | // Client-streaming request. |
| 110 | message StreamingInputCallRequest { |
| 111 | // Optional input payload sent along with the request. |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 112 | Payload payload = 1; |
chenw | a8fd44a | 2014-12-10 15:13:55 -0800 | [diff] [blame] | 113 | |
| 114 | // Not expecting any payload from the response. |
| 115 | } |
| 116 | |
| 117 | // Client-streaming response. |
| 118 | message StreamingInputCallResponse { |
| 119 | // Aggregated size of payloads received from the client. |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 120 | int32 aggregated_payload_size = 1; |
chenw | a8fd44a | 2014-12-10 15:13:55 -0800 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | // Configuration for a particular response. |
| 124 | message ResponseParameters { |
| 125 | // Desired payload sizes in responses from the server. |
| 126 | // If response_type is COMPRESSABLE, this denotes the size before compression. |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 127 | int32 size = 1; |
chenw | a8fd44a | 2014-12-10 15:13:55 -0800 | [diff] [blame] | 128 | |
| 129 | // Desired interval between consecutive responses in the response stream in |
| 130 | // microseconds. |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 131 | int32 interval_us = 2; |
chenw | a8fd44a | 2014-12-10 15:13:55 -0800 | [diff] [blame] | 132 | } |
| 133 | |
| 134 | // Server-streaming request. |
| 135 | message StreamingOutputCallRequest { |
| 136 | // Desired payload type in the response from the server. |
| 137 | // If response_type is RANDOM, the payload from each response in the stream |
| 138 | // might be of different types. This is to simulate a mixed type of payload |
| 139 | // stream. |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 140 | PayloadType response_type = 1; |
chenw | a8fd44a | 2014-12-10 15:13:55 -0800 | [diff] [blame] | 141 | |
| 142 | // Configuration for each expected response message. |
| 143 | repeated ResponseParameters response_parameters = 2; |
| 144 | |
| 145 | // Optional input payload sent along with the request. |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 146 | Payload payload = 3; |
Abhishek Kumar | 905a65b | 2015-06-19 15:28:07 -0700 | [diff] [blame] | 147 | |
| 148 | // Compression algorithm to be used by the server for the response (stream) |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 149 | CompressionType response_compression = 6; |
Abhishek Kumar | 905a65b | 2015-06-19 15:28:07 -0700 | [diff] [blame] | 150 | |
| 151 | // Whether server should return a given status |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 152 | EchoStatus response_status = 7; |
chenw | a8fd44a | 2014-12-10 15:13:55 -0800 | [diff] [blame] | 153 | } |
| 154 | |
| 155 | // Server-streaming response, as configured by the request and parameters. |
| 156 | message StreamingOutputCallResponse { |
| 157 | // Payload to increase response size. |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 158 | Payload payload = 1; |
chenw | a8fd44a | 2014-12-10 15:13:55 -0800 | [diff] [blame] | 159 | } |
yang-g | c9c69e2 | 2015-07-24 14:38:26 -0700 | [diff] [blame] | 160 | |
| 161 | // For reconnect interop test only. |
| 162 | // Server tells client whether its reconnects are following the spec and the |
| 163 | // reconnect backoffs it saw. |
| 164 | message ReconnectInfo { |
yang-g | f6befe8 | 2015-08-13 13:51:53 -0700 | [diff] [blame] | 165 | bool passed = 1; |
yang-g | c9c69e2 | 2015-07-24 14:38:26 -0700 | [diff] [blame] | 166 | repeated int32 backoff_ms = 2; |
| 167 | } |