OSDN Git Service

new repo
[bytom/vapor.git] / vendor / google.golang.org / grpc / interop / grpc_testing / test.proto
1 // Copyright 2017 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
15 // An integration test service that covers all the method signature permutations
16 // of unary/streaming requests/responses.
17 syntax = "proto3";
18
19 package grpc.testing;
20
21 message Empty {}
22
23 // The type of payload that should be returned.
24 enum PayloadType {
25   // Compressable text format.
26   COMPRESSABLE = 0;
27
28   // Uncompressable binary format.
29   UNCOMPRESSABLE = 1;
30
31   // Randomly chosen from all other formats defined in this enum.
32   RANDOM = 2;
33 }
34
35 // A block of data, to simply increase gRPC message size.
36 message Payload {
37   // The type of data in body.
38   PayloadType type = 1;
39   // Primary contents of payload.
40   bytes body = 2;
41 }
42
43 // A protobuf representation for grpc status. This is used by test
44 // clients to specify a status that the server should attempt to return.
45 message EchoStatus {
46   int32 code = 1;
47   string message = 2;
48 }
49
50 // Unary request.
51 message SimpleRequest {
52   // Desired payload type in the response from the server.
53   // If response_type is RANDOM, server randomly chooses one from other formats.
54   PayloadType response_type = 1;
55
56   // Desired payload size in the response from the server.
57   // If response_type is COMPRESSABLE, this denotes the size before compression.
58   int32 response_size = 2;
59
60   // Optional input payload sent along with the request.
61   Payload payload = 3;
62
63   // Whether SimpleResponse should include username.
64   bool fill_username = 4;
65
66   // Whether SimpleResponse should include OAuth scope.
67   bool fill_oauth_scope = 5;
68
69   // Whether server should return a given status
70   EchoStatus response_status = 7;
71 }
72
73 // Unary response, as configured by the request.
74 message SimpleResponse {
75   // Payload to increase message size.
76   Payload payload = 1;
77
78   // The user the request came from, for verifying authentication was
79   // successful when the client expected it.
80   string username = 2;
81   
82   // OAuth scope.
83   string oauth_scope = 3;
84 }
85
86 // Client-streaming request.
87 message StreamingInputCallRequest {
88   // Optional input payload sent along with the request.
89   Payload payload = 1;
90
91   // Not expecting any payload from the response.
92 }
93
94 // Client-streaming response.
95 message StreamingInputCallResponse {
96   // Aggregated size of payloads received from the client.
97   int32 aggregated_payload_size = 1;
98 }
99
100 // Configuration for a particular response.
101 message ResponseParameters {
102   // Desired payload sizes in responses from the server.
103   // If response_type is COMPRESSABLE, this denotes the size before compression.
104   int32 size = 1;
105
106   // Desired interval between consecutive responses in the response stream in
107   // microseconds.
108   int32 interval_us = 2;
109 }
110
111 // Server-streaming request.
112 message StreamingOutputCallRequest {
113   // Desired payload type in the response from the server.
114   // If response_type is RANDOM, the payload from each response in the stream
115   // might be of different types. This is to simulate a mixed type of payload
116   // stream.
117   PayloadType response_type = 1;
118
119   // Configuration for each expected response message.
120   repeated ResponseParameters response_parameters = 2;
121
122   // Optional input payload sent along with the request.
123   Payload payload = 3;
124
125   // Whether server should return a given status
126   EchoStatus response_status = 7;
127 }
128
129 // Server-streaming response, as configured by the request and parameters.
130 message StreamingOutputCallResponse {
131   // Payload to increase response size.
132   Payload payload = 1;
133 }
134
135 // A simple service to test the various types of RPCs and experiment with
136 // performance with various types of payload.
137 service TestService {
138   // One empty request followed by one empty response.
139   rpc EmptyCall(Empty) returns (Empty);
140
141   // One request followed by one response.
142   // The server returns the client payload as-is.
143   rpc UnaryCall(SimpleRequest) returns (SimpleResponse);
144
145   // One request followed by a sequence of responses (streamed download).
146   // The server returns the payload with client desired type and sizes.
147   rpc StreamingOutputCall(StreamingOutputCallRequest)
148       returns (stream StreamingOutputCallResponse);
149
150   // A sequence of requests followed by one response (streamed upload).
151   // The server returns the aggregated size of client payload as the result.
152   rpc StreamingInputCall(stream StreamingInputCallRequest)
153       returns (StreamingInputCallResponse);
154
155   // A sequence of requests with each request served by the server immediately.
156   // As one request could lead to multiple responses, this interface
157   // demonstrates the idea of full duplexing.
158   rpc FullDuplexCall(stream StreamingOutputCallRequest)
159       returns (stream StreamingOutputCallResponse);
160
161   // A sequence of requests followed by a sequence of responses.
162   // The server buffers all the client requests and then serves them in order. A
163   // stream of responses are returned to the client when the server starts with
164   // first request.
165   rpc HalfDuplexCall(stream StreamingOutputCallRequest)
166       returns (stream StreamingOutputCallResponse);
167 }
168
169 // A simple service NOT implemented at servers so clients can test for
170 // that case.
171 service UnimplementedService {
172   // A call that no server should implement
173   rpc UnimplementedCall(grpc.testing.Empty) returns (grpc.testing.Empty);
174 }