messages.proto 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. // Copyright 2016 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. // Message definitions to be used by integration test service definitions.
  15. syntax = "proto3";
  16. package grpc.testing;
  17. // The type of payload that should be returned.
  18. enum PayloadType {
  19. // Compressable text format.
  20. COMPRESSABLE = 0;
  21. // Uncompressable binary format.
  22. UNCOMPRESSABLE = 1;
  23. // Randomly chosen from all other formats defined in this enum.
  24. RANDOM = 2;
  25. }
  26. // Compression algorithms
  27. enum CompressionType {
  28. // No compression
  29. NONE = 0;
  30. GZIP = 1;
  31. DEFLATE = 2;
  32. }
  33. // A block of data, to simply increase gRPC message size.
  34. message Payload {
  35. // The type of data in body.
  36. PayloadType type = 1;
  37. // Primary contents of payload.
  38. bytes body = 2;
  39. }
  40. // A protobuf representation for grpc status. This is used by test
  41. // clients to specify a status that the server should attempt to return.
  42. message EchoStatus {
  43. int32 code = 1;
  44. string message = 2;
  45. }
  46. // Unary request.
  47. message SimpleRequest {
  48. // Desired payload type in the response from the server.
  49. // If response_type is RANDOM, server randomly chooses one from other formats.
  50. PayloadType response_type = 1;
  51. // Desired payload size in the response from the server.
  52. // If response_type is COMPRESSABLE, this denotes the size before compression.
  53. int32 response_size = 2;
  54. // Optional input payload sent along with the request.
  55. Payload payload = 3;
  56. // Whether SimpleResponse should include username.
  57. bool fill_username = 4;
  58. // Whether SimpleResponse should include OAuth scope.
  59. bool fill_oauth_scope = 5;
  60. // Compression algorithm to be used by the server for the response (stream)
  61. CompressionType response_compression = 6;
  62. // Whether server should return a given status
  63. EchoStatus response_status = 7;
  64. }
  65. // Unary response, as configured by the request.
  66. message SimpleResponse {
  67. // Payload to increase message size.
  68. Payload payload = 1;
  69. // The user the request came from, for verifying authentication was
  70. // successful when the client expected it.
  71. string username = 2;
  72. // OAuth scope.
  73. string oauth_scope = 3;
  74. }
  75. // Client-streaming request.
  76. message StreamingInputCallRequest {
  77. // Optional input payload sent along with the request.
  78. Payload payload = 1;
  79. // Not expecting any payload from the response.
  80. }
  81. // Client-streaming response.
  82. message StreamingInputCallResponse {
  83. // Aggregated size of payloads received from the client.
  84. int32 aggregated_payload_size = 1;
  85. }
  86. // Configuration for a particular response.
  87. message ResponseParameters {
  88. // Desired payload sizes in responses from the server.
  89. // If response_type is COMPRESSABLE, this denotes the size before compression.
  90. int32 size = 1;
  91. // Desired interval between consecutive responses in the response stream in
  92. // microseconds.
  93. int32 interval_us = 2;
  94. }
  95. // Server-streaming request.
  96. message StreamingOutputCallRequest {
  97. // Desired payload type in the response from the server.
  98. // If response_type is RANDOM, the payload from each response in the stream
  99. // might be of different types. This is to simulate a mixed type of payload
  100. // stream.
  101. PayloadType response_type = 1;
  102. // Configuration for each expected response message.
  103. repeated ResponseParameters response_parameters = 2;
  104. // Optional input payload sent along with the request.
  105. Payload payload = 3;
  106. // Compression algorithm to be used by the server for the response (stream)
  107. CompressionType response_compression = 6;
  108. // Whether server should return a given status
  109. EchoStatus response_status = 7;
  110. }
  111. // Server-streaming response, as configured by the request and parameters.
  112. message StreamingOutputCallResponse {
  113. // Payload to increase response size.
  114. Payload payload = 1;
  115. }
  116. // For reconnect interop test only.
  117. // Client tells server what reconnection parameters it used.
  118. message ReconnectParams {
  119. int32 max_reconnect_backoff_ms = 1;
  120. }
  121. // For reconnect interop test only.
  122. // Server tells client whether its reconnects are following the spec and the
  123. // reconnect backoffs it saw.
  124. message ReconnectInfo {
  125. bool passed = 1;
  126. repeated int32 backoff_ms = 2;
  127. }