~ubuntu-branches/ubuntu/wily/grpc/wily-proposed

« back to all changes in this revision

Viewing changes to test/proto/messages.proto

  • Committer: Package Import Robot
  • Author(s): Andrew Pollock
  • Date: 2015-05-07 13:28:11 UTC
  • Revision ID: package-import@ubuntu.com-20150507132811-ybm4hfq73tnvvd2e
Tags: upstream-0.10.0
ImportĀ upstreamĀ versionĀ 0.10.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
// Copyright 2015, Google Inc.
 
3
// All rights reserved.
 
4
//
 
5
// Redistribution and use in source and binary forms, with or without
 
6
// modification, are permitted provided that the following conditions are
 
7
// met:
 
8
//
 
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.
 
18
//
 
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
 
 
31
// Message definitions to be used by integration test service definitions.
 
32
 
 
33
syntax = "proto2";
 
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
 
 
49
// Compression algorithms
 
50
enum CompressionType {
 
51
  // No compression
 
52
  NONE = 0;
 
53
  GZIP = 1;
 
54
  DEFLATE = 2;
 
55
}
 
56
 
 
57
// A block of data, to simply increase gRPC message size.
 
58
message Payload {
 
59
  // The type of data in body.
 
60
  optional PayloadType type = 1;
 
61
  // Primary contents of payload.
 
62
  optional bytes body = 2;
 
63
}
 
64
 
 
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.
 
67
message EchoStatus { 
 
68
  optional int32 code = 1;
 
69
  optional string message = 2;
 
70
}
 
71
 
 
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.
 
76
  optional PayloadType response_type = 1;
 
77
 
 
78
  // Desired payload size in the response from the server.
 
79
  // If response_type is COMPRESSABLE, this denotes the size before compression.
 
80
  optional int32 response_size = 2;
 
81
 
 
82
  // Optional input payload sent along with the request.
 
83
  optional Payload payload = 3;
 
84
 
 
85
  // Whether SimpleResponse should include username.
 
86
  optional bool fill_username = 4;
 
87
 
 
88
  // Whether SimpleResponse should include OAuth scope.
 
89
  optional bool fill_oauth_scope = 5;
 
90
 
 
91
  // Compression algorithm to be used by the server for the response (stream)
 
92
  optional CompressionType response_compression = 6;
 
93
 
 
94
  // Whether server should return a given status
 
95
  optional EchoStatus response_status = 7;
 
96
}
 
97
 
 
98
// Unary response, as configured by the request.
 
99
message SimpleResponse {
 
100
  // Payload to increase message size.
 
101
  optional Payload payload = 1;
 
102
  // The user the request came from, for verifying authentication was
 
103
  // successful when the client expected it.
 
104
  optional string username = 2;
 
105
  // OAuth scope.
 
106
  optional string oauth_scope = 3;
 
107
}
 
108
 
 
109
// Client-streaming request.
 
110
message StreamingInputCallRequest {
 
111
  // Optional input payload sent along with the request.
 
112
  optional Payload payload = 1;
 
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.
 
120
  optional int32 aggregated_payload_size = 1;
 
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.
 
127
  optional int32 size = 1;
 
128
 
 
129
  // Desired interval between consecutive responses in the response stream in
 
130
  // microseconds.
 
131
  optional int32 interval_us = 2;
 
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.
 
140
  optional PayloadType response_type = 1;
 
141
 
 
142
  // Configuration for each expected response message.
 
143
  repeated ResponseParameters response_parameters = 2;
 
144
 
 
145
  // Optional input payload sent along with the request.
 
146
  optional Payload payload = 3;
 
147
 
 
148
  // Compression algorithm to be used by the server for the response (stream)
 
149
  optional CompressionType response_compression = 6;
 
150
 
 
151
  // Whether server should return a given status
 
152
  optional EchoStatus response_status = 7;
 
153
}
 
154
 
 
155
// Server-streaming response, as configured by the request and parameters.
 
156
message StreamingOutputCallResponse {
 
157
  // Payload to increase response size.
 
158
  optional Payload payload = 1;
 
159
}