github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/grpc/test/grpc_testing/test.proto (about)

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