OSDN Git Service

new repo
[bytom/vapor.git] / vendor / google.golang.org / grpc / test / 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 // Unary request.
44 message SimpleRequest {
45   // Desired payload type in the response from the server.
46   // If response_type is RANDOM, server randomly chooses one from other formats.
47   PayloadType response_type = 1;
48
49   // Desired payload size in the response from the server.
50   // If response_type is COMPRESSABLE, this denotes the size before compression.
51   int32 response_size = 2;
52
53   // Optional input payload sent along with the request.
54   Payload payload = 3;
55
56   // Whether SimpleResponse should include username.
57   bool fill_username = 4;
58
59   // Whether SimpleResponse should include OAuth scope.
60   bool fill_oauth_scope = 5;
61 }
62
63 // Unary response, as configured by the request.
64 message SimpleResponse {
65   // Payload to increase message size.
66   Payload payload = 1;
67
68   // The user the request came from, for verifying authentication was
69   // successful when the client expected it.
70   string username = 2;
71   
72   // OAuth scope.
73   string oauth_scope = 3;
74 }
75
76 // Client-streaming request.
77 message StreamingInputCallRequest {
78   // Optional input payload sent along with the request.
79   Payload payload = 1;
80
81   // Not expecting any payload from the response.
82 }
83
84 // Client-streaming response.
85 message StreamingInputCallResponse {
86   // Aggregated size of payloads received from the client.
87   int32 aggregated_payload_size = 1;
88 }
89
90 // Configuration for a particular response.
91 message ResponseParameters {
92   // Desired payload sizes in responses from the server.
93   // If response_type is COMPRESSABLE, this denotes the size before compression.
94   int32 size = 1;
95
96   // Desired interval between consecutive responses in the response stream in
97   // microseconds.
98   int32 interval_us = 2;
99 }
100
101 // Server-streaming request.
102 message StreamingOutputCallRequest {
103   // Desired payload type in the response from the server.
104   // If response_type is RANDOM, the payload from each response in the stream
105   // might be of different types. This is to simulate a mixed type of payload
106   // stream.
107   PayloadType response_type = 1;
108
109   // Configuration for each expected response message.
110   repeated ResponseParameters response_parameters = 2;
111
112   // Optional input payload sent along with the request.
113   Payload payload = 3;
114 }
115
116 // Server-streaming response, as configured by the request and parameters.
117 message StreamingOutputCallResponse {
118   // Payload to increase response size.
119   Payload payload = 1;
120 }
121
122 // A simple service to test the various types of RPCs and experiment with
123 // performance with various types of payload.
124 service TestService {
125   // One empty request followed by one empty response.
126   rpc EmptyCall(Empty) returns (Empty);
127
128   // One request followed by one response.
129   // The server returns the client payload as-is.
130   rpc UnaryCall(SimpleRequest) returns (SimpleResponse);
131
132   // One request followed by a sequence of responses (streamed download).
133   // The server returns the payload with client desired type and sizes.
134   rpc StreamingOutputCall(StreamingOutputCallRequest)
135       returns (stream StreamingOutputCallResponse);
136
137   // A sequence of requests followed by one response (streamed upload).
138   // The server returns the aggregated size of client payload as the result.
139   rpc StreamingInputCall(stream StreamingInputCallRequest)
140       returns (StreamingInputCallResponse);
141
142   // A sequence of requests with each request served by the server immediately.
143   // As one request could lead to multiple responses, this interface
144   // demonstrates the idea of full duplexing.
145   rpc FullDuplexCall(stream StreamingOutputCallRequest)
146       returns (stream StreamingOutputCallResponse);
147
148   // A sequence of requests followed by a sequence of responses.
149   // The server buffers all the client requests and then serves them in order. A
150   // stream of responses are returned to the client when the server starts with
151   // first request.
152   rpc HalfDuplexCall(stream StreamingOutputCallRequest)
153       returns (stream StreamingOutputCallResponse);
154 }