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

« back to all changes in this revision

Viewing changes to test/compiler/test.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
// Copyright 2015, Google Inc.
 
2
// All rights reserved.
 
3
//
 
4
// Redistribution and use in source and binary forms, with or without
 
5
// modification, are permitted provided that the following conditions are
 
6
// met:
 
7
//
 
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
 
13
// distribution.
 
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.
 
17
//
 
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.
 
29
 
 
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.
 
33
syntax = "proto2";
 
34
 
 
35
package grpc.testing;
 
36
 
 
37
enum PayloadType {
 
38
  // Compressable text format.
 
39
  COMPRESSABLE= 1;
 
40
 
 
41
  // Uncompressable binary format.
 
42
  UNCOMPRESSABLE = 2;
 
43
 
 
44
  // Randomly chosen from all other formats defined in this enum.
 
45
  RANDOM = 3;
 
46
}
 
47
 
 
48
message Payload {
 
49
  required PayloadType payload_type = 1;
 
50
  oneof payload_body {
 
51
    string payload_compressable = 2;
 
52
    bytes payload_uncompressable = 3;
 
53
  }
 
54
}
 
55
 
 
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];
 
60
 
 
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;
 
64
 
 
65
  // Optional input payload sent along with the request.
 
66
  optional Payload payload = 3;
 
67
}
 
68
 
 
69
message SimpleResponse {
 
70
  optional Payload payload = 1;
 
71
}
 
72
 
 
73
message StreamingInputCallRequest {
 
74
  // Optional input payload sent along with the request.
 
75
  optional Payload payload = 1;
 
76
 
 
77
  // Not expecting any payload from the response.
 
78
}
 
79
 
 
80
message StreamingInputCallResponse {
 
81
  // Aggregated size of payloads received from the client.
 
82
  optional int32 aggregated_payload_size = 1;
 
83
}
 
84
 
 
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;
 
89
 
 
90
  // Desired interval between consecutive responses in the response stream in
 
91
  // microseconds.
 
92
  required int32 interval_us = 2;
 
93
}
 
94
 
 
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
 
99
  // stream.
 
100
  optional PayloadType response_type = 1 [default=COMPRESSABLE];
 
101
 
 
102
  repeated ResponseParameters response_parameters = 2;
 
103
 
 
104
  // Optional input payload sent along with the request.
 
105
  optional Payload payload = 3;
 
106
}
 
107
 
 
108
message StreamingOutputCallResponse {
 
109
  optional Payload payload = 1;
 
110
}
 
111
 
 
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);
 
116
 
 
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);
 
121
 
 
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);
 
126
 
 
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);
 
132
 
 
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
 
136
  // first request.
 
137
  rpc HalfDuplexCall(stream StreamingOutputCallRequest)
 
138
      returns (stream StreamingOutputCallResponse);
 
139
}