1
// Copyright 2015, Google Inc.
2
// All rights reserved.
4
// Redistribution and use in source and binary forms, with or without
5
// modification, are permitted provided that the following conditions are
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
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.
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.
30
// An integration test service that covers all the method signature permutations
31
// of unary/streaming requests/responses.
32
// This file is duplicated around the code base. See GitHub issue #526.
38
// Compressable text format.
41
// Uncompressable binary format.
44
// Randomly chosen from all other formats defined in this enum.
49
required PayloadType payload_type = 1;
51
string payload_compressable = 2;
52
bytes payload_uncompressable = 3;
56
message SimpleRequest {
57
// Desired payload type in the response from the server.
58
// If response_type is RANDOM, server randomly chooses one from other formats.
59
optional PayloadType response_type = 1 [default=COMPRESSABLE];
61
// Desired payload size in the response from the server.
62
// If response_type is COMPRESSABLE, this denotes the size before compression.
63
optional int32 response_size = 2;
65
// Optional input payload sent along with the request.
66
optional Payload payload = 3;
69
message SimpleResponse {
70
optional Payload payload = 1;
73
message StreamingInputCallRequest {
74
// Optional input payload sent along with the request.
75
optional Payload payload = 1;
77
// Not expecting any payload from the response.
80
message StreamingInputCallResponse {
81
// Aggregated size of payloads received from the client.
82
optional int32 aggregated_payload_size = 1;
85
message ResponseParameters {
86
// Desired payload sizes in responses from the server.
87
// If response_type is COMPRESSABLE, this denotes the size before compression.
88
required int32 size = 1;
90
// Desired interval between consecutive responses in the response stream in
92
required int32 interval_us = 2;
95
message StreamingOutputCallRequest {
96
// Desired payload type in the response from the server.
97
// If response_type is RANDOM, the payload from each response in the stream
98
// might be of different types. This is to simulate a mixed type of payload
100
optional PayloadType response_type = 1 [default=COMPRESSABLE];
102
repeated ResponseParameters response_parameters = 2;
104
// Optional input payload sent along with the request.
105
optional Payload payload = 3;
108
message StreamingOutputCallResponse {
109
optional Payload payload = 1;
112
service TestService {
113
// One request followed by one response.
114
// The server returns the client payload as-is.
115
rpc UnaryCall(SimpleRequest) returns (SimpleResponse);
117
// One request followed by a sequence of responses (streamed download).
118
// The server returns the payload with client desired type and sizes.
119
rpc StreamingOutputCall(StreamingOutputCallRequest)
120
returns (stream StreamingOutputCallResponse);
122
// A sequence of requests followed by one response (streamed upload).
123
// The server returns the aggregated size of client payload as the result.
124
rpc StreamingInputCall(stream StreamingInputCallRequest)
125
returns (StreamingInputCallResponse);
127
// A sequence of requests with each request served by the server immediately.
128
// As one request could lead to multiple responses, this interface
129
// demonstrates the idea of full duplexing.
130
rpc FullDuplexCall(stream StreamingOutputCallRequest)
131
returns (stream StreamingOutputCallResponse);
133
// A sequence of requests followed by a sequence of responses.
134
// The server buffers all the client requests and then serves them in order. A
135
// stream of responses are returned to the client when the server starts with
137
rpc HalfDuplexCall(stream StreamingOutputCallRequest)
138
returns (stream StreamingOutputCallResponse);