1<?php 2// GENERATED CODE -- DO NOT EDIT! 3 4// Original file comments: 5// Copyright 2015-2016 gRPC authors. 6// 7// Licensed under the Apache License, Version 2.0 (the "License"); 8// you may not use this file except in compliance with the License. 9// You may obtain a copy of the License at 10// 11// http://www.apache.org/licenses/LICENSE-2.0 12// 13// Unless required by applicable law or agreed to in writing, software 14// distributed under the License is distributed on an "AS IS" BASIS, 15// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16// See the License for the specific language governing permissions and 17// limitations under the License. 18// 19// An integration test service that covers all the method signature permutations 20// of unary/streaming requests/responses. 21// 22namespace Grpc\Testing; 23 24/** 25 * A simple service to test the various types of RPCs and experiment with 26 * performance with various types of payload. 27 */ 28class TestServiceStub { 29 30 /** 31 * One empty request followed by one empty response. 32 * @param \Grpc\Testing\EmptyMessage $request client request 33 * @param \Grpc\ServerContext $context server request context 34 * @return \Grpc\Testing\EmptyMessage for response data, null if if error occured 35 * initial metadata (if any) and status (if not ok) should be set to $context 36 */ 37 public function EmptyCall( 38 \Grpc\Testing\EmptyMessage $request, 39 \Grpc\ServerContext $context 40 ): ?\Grpc\Testing\EmptyMessage { 41 $context->setStatus(\Grpc\Status::unimplemented()); 42 return null; 43 } 44 45 /** 46 * One request followed by one response. 47 * @param \Grpc\Testing\SimpleRequest $request client request 48 * @param \Grpc\ServerContext $context server request context 49 * @return \Grpc\Testing\SimpleResponse for response data, null if if error occured 50 * initial metadata (if any) and status (if not ok) should be set to $context 51 */ 52 public function UnaryCall( 53 \Grpc\Testing\SimpleRequest $request, 54 \Grpc\ServerContext $context 55 ): ?\Grpc\Testing\SimpleResponse { 56 $context->setStatus(\Grpc\Status::unimplemented()); 57 return null; 58 } 59 60 /** 61 * One request followed by one response. Response has cache control 62 * headers set such that a caching HTTP proxy (such as GFE) can 63 * satisfy subsequent requests. 64 * @param \Grpc\Testing\SimpleRequest $request client request 65 * @param \Grpc\ServerContext $context server request context 66 * @return \Grpc\Testing\SimpleResponse for response data, null if if error occured 67 * initial metadata (if any) and status (if not ok) should be set to $context 68 */ 69 public function CacheableUnaryCall( 70 \Grpc\Testing\SimpleRequest $request, 71 \Grpc\ServerContext $context 72 ): ?\Grpc\Testing\SimpleResponse { 73 $context->setStatus(\Grpc\Status::unimplemented()); 74 return null; 75 } 76 77 /** 78 * One request followed by a sequence of responses (streamed download). 79 * The server returns the payload with client desired type and sizes. 80 * @param \Grpc\Testing\StreamingOutputCallRequest $request client request 81 * @param \Grpc\ServerCallWriter $writer write response data of \Grpc\Testing\StreamingOutputCallResponse 82 * @param \Grpc\ServerContext $context server request context 83 * @return void 84 */ 85 public function StreamingOutputCall( 86 \Grpc\Testing\StreamingOutputCallRequest $request, 87 \Grpc\ServerCallWriter $writer, 88 \Grpc\ServerContext $context 89 ): void { 90 $context->setStatus(\Grpc\Status::unimplemented()); 91 $writer->finish(); 92 } 93 94 /** 95 * A sequence of requests followed by one response (streamed upload). 96 * The server returns the aggregated size of client payload as the result. 97 * @param \Grpc\ServerCallReader $reader read client request data of \Grpc\Testing\StreamingInputCallRequest 98 * @param \Grpc\ServerContext $context server request context 99 * @return \Grpc\Testing\StreamingInputCallResponse for response data, null if if error occured 100 * initial metadata (if any) and status (if not ok) should be set to $context 101 */ 102 public function StreamingInputCall( 103 \Grpc\ServerCallReader $reader, 104 \Grpc\ServerContext $context 105 ): ?\Grpc\Testing\StreamingInputCallResponse { 106 $context->setStatus(\Grpc\Status::unimplemented()); 107 return null; 108 } 109 110 /** 111 * A sequence of requests with each request served by the server immediately. 112 * As one request could lead to multiple responses, this interface 113 * demonstrates the idea of full duplexing. 114 * @param \Grpc\ServerCallReader $reader read client request data of \Grpc\Testing\StreamingOutputCallRequest 115 * @param \Grpc\ServerCallWriter $writer write response data of \Grpc\Testing\StreamingOutputCallResponse 116 * @param \Grpc\ServerContext $context server request context 117 * @return void 118 */ 119 public function FullDuplexCall( 120 \Grpc\ServerCallReader $reader, 121 \Grpc\ServerCallWriter $writer, 122 \Grpc\ServerContext $context 123 ): void { 124 $context->setStatus(\Grpc\Status::unimplemented()); 125 $writer->finish(); 126 } 127 128 /** 129 * A sequence of requests followed by a sequence of responses. 130 * The server buffers all the client requests and then serves them in order. A 131 * stream of responses are returned to the client when the server starts with 132 * first request. 133 * @param \Grpc\ServerCallReader $reader read client request data of \Grpc\Testing\StreamingOutputCallRequest 134 * @param \Grpc\ServerCallWriter $writer write response data of \Grpc\Testing\StreamingOutputCallResponse 135 * @param \Grpc\ServerContext $context server request context 136 * @return void 137 */ 138 public function HalfDuplexCall( 139 \Grpc\ServerCallReader $reader, 140 \Grpc\ServerCallWriter $writer, 141 \Grpc\ServerContext $context 142 ): void { 143 $context->setStatus(\Grpc\Status::unimplemented()); 144 $writer->finish(); 145 } 146 147 /** 148 * The test server will not implement this method. It will be used 149 * to test the behavior when clients call unimplemented methods. 150 * @param \Grpc\Testing\EmptyMessage $request client request 151 * @param \Grpc\ServerContext $context server request context 152 * @return \Grpc\Testing\EmptyMessage for response data, null if if error occured 153 * initial metadata (if any) and status (if not ok) should be set to $context 154 */ 155 public function UnimplementedCall( 156 \Grpc\Testing\EmptyMessage $request, 157 \Grpc\ServerContext $context 158 ): ?\Grpc\Testing\EmptyMessage { 159 $context->setStatus(\Grpc\Status::unimplemented()); 160 return null; 161 } 162 163 /** 164 * Get the method descriptors of the service for server registration 165 * 166 * @return array of \Grpc\MethodDescriptor for the service methods 167 */ 168 public final function getMethodDescriptors(): array 169 { 170 return [ 171 '/grpc.testing.TestService/EmptyCall' => new \Grpc\MethodDescriptor( 172 $this, 173 'EmptyCall', 174 '\Grpc\Testing\EmptyMessage', 175 \Grpc\MethodDescriptor::UNARY_CALL 176 ), 177 '/grpc.testing.TestService/UnaryCall' => new \Grpc\MethodDescriptor( 178 $this, 179 'UnaryCall', 180 '\Grpc\Testing\SimpleRequest', 181 \Grpc\MethodDescriptor::UNARY_CALL 182 ), 183 '/grpc.testing.TestService/CacheableUnaryCall' => new \Grpc\MethodDescriptor( 184 $this, 185 'CacheableUnaryCall', 186 '\Grpc\Testing\SimpleRequest', 187 \Grpc\MethodDescriptor::UNARY_CALL 188 ), 189 '/grpc.testing.TestService/StreamingOutputCall' => new \Grpc\MethodDescriptor( 190 $this, 191 'StreamingOutputCall', 192 '\Grpc\Testing\StreamingOutputCallRequest', 193 \Grpc\MethodDescriptor::SERVER_STREAMING_CALL 194 ), 195 '/grpc.testing.TestService/StreamingInputCall' => new \Grpc\MethodDescriptor( 196 $this, 197 'StreamingInputCall', 198 '\Grpc\Testing\StreamingInputCallRequest', 199 \Grpc\MethodDescriptor::CLIENT_STREAMING_CALL 200 ), 201 '/grpc.testing.TestService/FullDuplexCall' => new \Grpc\MethodDescriptor( 202 $this, 203 'FullDuplexCall', 204 '\Grpc\Testing\StreamingOutputCallRequest', 205 \Grpc\MethodDescriptor::BIDI_STREAMING_CALL 206 ), 207 '/grpc.testing.TestService/HalfDuplexCall' => new \Grpc\MethodDescriptor( 208 $this, 209 'HalfDuplexCall', 210 '\Grpc\Testing\StreamingOutputCallRequest', 211 \Grpc\MethodDescriptor::BIDI_STREAMING_CALL 212 ), 213 '/grpc.testing.TestService/UnimplementedCall' => new \Grpc\MethodDescriptor( 214 $this, 215 'UnimplementedCall', 216 '\Grpc\Testing\EmptyMessage', 217 \Grpc\MethodDescriptor::UNARY_CALL 218 ), 219 ]; 220 } 221 222} 223