1<?hh // strict 2/** 3 * Autogenerated by Thrift 4 * 5 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 6 * @generated 7 */ 8 9/** 10 * Original thrift service:- 11 * DbMixedStackArguments 12 */ 13interface DbMixedStackArgumentsAsyncIf extends \IThriftAsyncIf { 14 /** 15 * Original thrift definition:- 16 * binary 17 * getDataByKey0(1: string key); 18 */ 19 public function getDataByKey0(string $key): Awaitable<string>; 20 21 /** 22 * Original thrift definition:- 23 * binary 24 * getDataByKey1(1: string key); 25 */ 26 public function getDataByKey1(string $key): Awaitable<string>; 27} 28 29/** 30 * Original thrift service:- 31 * DbMixedStackArguments 32 */ 33interface DbMixedStackArgumentsIf extends \IThriftSyncIf { 34 /** 35 * Original thrift definition:- 36 * binary 37 * getDataByKey0(1: string key); 38 */ 39 public function getDataByKey0(string $key): string; 40 41 /** 42 * Original thrift definition:- 43 * binary 44 * getDataByKey1(1: string key); 45 */ 46 public function getDataByKey1(string $key): string; 47} 48 49/** 50 * Original thrift service:- 51 * DbMixedStackArguments 52 */ 53interface DbMixedStackArgumentsAsyncClientIf extends DbMixedStackArgumentsAsyncIf { 54} 55 56/** 57 * Original thrift service:- 58 * DbMixedStackArguments 59 */ 60interface DbMixedStackArgumentsClientIf extends \IThriftSyncIf { 61 /** 62 * Original thrift definition:- 63 * binary 64 * getDataByKey0(1: string key); 65 */ 66 public function getDataByKey0(string $key): Awaitable<string>; 67 68 /** 69 * Original thrift definition:- 70 * binary 71 * getDataByKey1(1: string key); 72 */ 73 public function getDataByKey1(string $key): Awaitable<string>; 74} 75 76/** 77 * Original thrift service:- 78 * DbMixedStackArguments 79 */ 80interface DbMixedStackArgumentsAsyncRpcOptionsIf extends \IThriftAsyncRpcOptionsIf { 81 /** 82 * Original thrift definition:- 83 * binary 84 * getDataByKey0(1: string key); 85 */ 86 public function getDataByKey0(\RpcOptions $rpc_options, string $key): Awaitable<string>; 87 88 /** 89 * Original thrift definition:- 90 * binary 91 * getDataByKey1(1: string key); 92 */ 93 public function getDataByKey1(\RpcOptions $rpc_options, string $key): Awaitable<string>; 94} 95 96/** 97 * Original thrift service:- 98 * DbMixedStackArguments 99 */ 100trait DbMixedStackArgumentsClientBase { 101 require extends \ThriftClientBase; 102 103 protected function sendImpl_getDataByKey0(string $key): int { 104 $currentseqid = $this->getNextSequenceID(); 105 $args = DbMixedStackArguments_getDataByKey0_args::fromShape(shape( 106 'key' => $key, 107 )); 108 try { 109 $this->eventHandler_->preSend('getDataByKey0', $args, $currentseqid); 110 if ($this->output_ is \TBinaryProtocolAccelerated) 111 { 112 \thrift_protocol_write_binary($this->output_, 'getDataByKey0', \TMessageType::CALL, $args, $currentseqid, $this->output_->isStrictWrite(), false); 113 } 114 else if ($this->output_ is \TCompactProtocolAccelerated) 115 { 116 \thrift_protocol_write_compact($this->output_, 'getDataByKey0', \TMessageType::CALL, $args, $currentseqid, false); 117 } 118 else 119 { 120 $this->output_->writeMessageBegin('getDataByKey0', \TMessageType::CALL, $currentseqid); 121 $args->write($this->output_); 122 $this->output_->writeMessageEnd(); 123 $this->output_->getTransport()->flush(); 124 } 125 } catch (\THandlerShortCircuitException $ex) { 126 switch ($ex->resultType) { 127 case \THandlerShortCircuitException::R_EXPECTED_EX: 128 case \THandlerShortCircuitException::R_UNEXPECTED_EX: 129 $this->eventHandler_->sendError('getDataByKey0', $args, $currentseqid, $ex->result); 130 throw $ex->result; 131 case \THandlerShortCircuitException::R_SUCCESS: 132 default: 133 $this->eventHandler_->postSend('getDataByKey0', $args, $currentseqid); 134 return $currentseqid; 135 } 136 } catch (\Exception $ex) { 137 $this->eventHandler_->sendError('getDataByKey0', $args, $currentseqid, $ex); 138 throw $ex; 139 } 140 $this->eventHandler_->postSend('getDataByKey0', $args, $currentseqid); 141 return $currentseqid; 142 } 143 144 protected function recvImpl_getDataByKey0(?int $expectedsequenceid = null, shape(?'read_options' => int) $options = shape()): string { 145 try { 146 $this->eventHandler_->preRecv('getDataByKey0', $expectedsequenceid); 147 if ($this->input_ is \TBinaryProtocolAccelerated) { 148 $result = \thrift_protocol_read_binary($this->input_, 'DbMixedStackArguments_getDataByKey0_result', $this->input_->isStrictRead(), Shapes::idx($options, 'read_options', 0)); 149 } else if ($this->input_ is \TCompactProtocolAccelerated) 150 { 151 $result = \thrift_protocol_read_compact($this->input_, 'DbMixedStackArguments_getDataByKey0_result', Shapes::idx($options, 'read_options', 0)); 152 } 153 else 154 { 155 $rseqid = 0; 156 $fname = ''; 157 $mtype = 0; 158 159 $this->input_->readMessageBegin( 160 inout $fname, 161 inout $mtype, 162 inout $rseqid, 163 ); 164 if ($mtype === \TMessageType::EXCEPTION) { 165 $x = new \TApplicationException(); 166 $x->read($this->input_); 167 $this->input_->readMessageEnd(); 168 throw $x; 169 } 170 $result = DbMixedStackArguments_getDataByKey0_result::withDefaultValues(); 171 $result->read($this->input_); 172 $this->input_->readMessageEnd(); 173 if ($expectedsequenceid !== null && ($rseqid !== $expectedsequenceid)) { 174 throw new \TProtocolException("getDataByKey0 failed: sequence id is out of order"); 175 } 176 } 177 } catch (\THandlerShortCircuitException $ex) { 178 switch ($ex->resultType) { 179 case \THandlerShortCircuitException::R_EXPECTED_EX: 180 $this->eventHandler_->recvException('getDataByKey0', $expectedsequenceid, $ex->result); 181 throw $ex->result; 182 case \THandlerShortCircuitException::R_UNEXPECTED_EX: 183 $this->eventHandler_->recvError('getDataByKey0', $expectedsequenceid, $ex->result); 184 throw $ex->result; 185 case \THandlerShortCircuitException::R_SUCCESS: 186 default: 187 $this->eventHandler_->postRecv('getDataByKey0', $expectedsequenceid, $ex->result); 188 return $ex->result; 189 } 190 } catch (\Exception $ex) { 191 $this->eventHandler_->recvError('getDataByKey0', $expectedsequenceid, $ex); 192 throw $ex; 193 } 194 if ($result->success !== null) { 195 $success = $result->success; 196 $this->eventHandler_->postRecv('getDataByKey0', $expectedsequenceid, $success); 197 return $success; 198 } 199 $x = new \TApplicationException("getDataByKey0 failed: unknown result", \TApplicationException::MISSING_RESULT); 200 $this->eventHandler_->recvError('getDataByKey0', $expectedsequenceid, $x); 201 throw $x; 202 } 203 204 protected function sendImpl_getDataByKey1(string $key): int { 205 $currentseqid = $this->getNextSequenceID(); 206 $args = DbMixedStackArguments_getDataByKey1_args::fromShape(shape( 207 'key' => $key, 208 )); 209 try { 210 $this->eventHandler_->preSend('getDataByKey1', $args, $currentseqid); 211 if ($this->output_ is \TBinaryProtocolAccelerated) 212 { 213 \thrift_protocol_write_binary($this->output_, 'getDataByKey1', \TMessageType::CALL, $args, $currentseqid, $this->output_->isStrictWrite(), false); 214 } 215 else if ($this->output_ is \TCompactProtocolAccelerated) 216 { 217 \thrift_protocol_write_compact($this->output_, 'getDataByKey1', \TMessageType::CALL, $args, $currentseqid, false); 218 } 219 else 220 { 221 $this->output_->writeMessageBegin('getDataByKey1', \TMessageType::CALL, $currentseqid); 222 $args->write($this->output_); 223 $this->output_->writeMessageEnd(); 224 $this->output_->getTransport()->flush(); 225 } 226 } catch (\THandlerShortCircuitException $ex) { 227 switch ($ex->resultType) { 228 case \THandlerShortCircuitException::R_EXPECTED_EX: 229 case \THandlerShortCircuitException::R_UNEXPECTED_EX: 230 $this->eventHandler_->sendError('getDataByKey1', $args, $currentseqid, $ex->result); 231 throw $ex->result; 232 case \THandlerShortCircuitException::R_SUCCESS: 233 default: 234 $this->eventHandler_->postSend('getDataByKey1', $args, $currentseqid); 235 return $currentseqid; 236 } 237 } catch (\Exception $ex) { 238 $this->eventHandler_->sendError('getDataByKey1', $args, $currentseqid, $ex); 239 throw $ex; 240 } 241 $this->eventHandler_->postSend('getDataByKey1', $args, $currentseqid); 242 return $currentseqid; 243 } 244 245 protected function recvImpl_getDataByKey1(?int $expectedsequenceid = null, shape(?'read_options' => int) $options = shape()): string { 246 try { 247 $this->eventHandler_->preRecv('getDataByKey1', $expectedsequenceid); 248 if ($this->input_ is \TBinaryProtocolAccelerated) { 249 $result = \thrift_protocol_read_binary($this->input_, 'DbMixedStackArguments_getDataByKey1_result', $this->input_->isStrictRead(), Shapes::idx($options, 'read_options', 0)); 250 } else if ($this->input_ is \TCompactProtocolAccelerated) 251 { 252 $result = \thrift_protocol_read_compact($this->input_, 'DbMixedStackArguments_getDataByKey1_result', Shapes::idx($options, 'read_options', 0)); 253 } 254 else 255 { 256 $rseqid = 0; 257 $fname = ''; 258 $mtype = 0; 259 260 $this->input_->readMessageBegin( 261 inout $fname, 262 inout $mtype, 263 inout $rseqid, 264 ); 265 if ($mtype === \TMessageType::EXCEPTION) { 266 $x = new \TApplicationException(); 267 $x->read($this->input_); 268 $this->input_->readMessageEnd(); 269 throw $x; 270 } 271 $result = DbMixedStackArguments_getDataByKey1_result::withDefaultValues(); 272 $result->read($this->input_); 273 $this->input_->readMessageEnd(); 274 if ($expectedsequenceid !== null && ($rseqid !== $expectedsequenceid)) { 275 throw new \TProtocolException("getDataByKey1 failed: sequence id is out of order"); 276 } 277 } 278 } catch (\THandlerShortCircuitException $ex) { 279 switch ($ex->resultType) { 280 case \THandlerShortCircuitException::R_EXPECTED_EX: 281 $this->eventHandler_->recvException('getDataByKey1', $expectedsequenceid, $ex->result); 282 throw $ex->result; 283 case \THandlerShortCircuitException::R_UNEXPECTED_EX: 284 $this->eventHandler_->recvError('getDataByKey1', $expectedsequenceid, $ex->result); 285 throw $ex->result; 286 case \THandlerShortCircuitException::R_SUCCESS: 287 default: 288 $this->eventHandler_->postRecv('getDataByKey1', $expectedsequenceid, $ex->result); 289 return $ex->result; 290 } 291 } catch (\Exception $ex) { 292 $this->eventHandler_->recvError('getDataByKey1', $expectedsequenceid, $ex); 293 throw $ex; 294 } 295 if ($result->success !== null) { 296 $success = $result->success; 297 $this->eventHandler_->postRecv('getDataByKey1', $expectedsequenceid, $success); 298 return $success; 299 } 300 $x = new \TApplicationException("getDataByKey1 failed: unknown result", \TApplicationException::MISSING_RESULT); 301 $this->eventHandler_->recvError('getDataByKey1', $expectedsequenceid, $x); 302 throw $x; 303 } 304 305} 306 307class DbMixedStackArgumentsAsyncClient extends \ThriftClientBase implements DbMixedStackArgumentsAsyncClientIf { 308 use DbMixedStackArgumentsClientBase; 309 310 /** 311 * Original thrift definition:- 312 * binary 313 * getDataByKey0(1: string key); 314 */ 315 public async function getDataByKey0(string $key): Awaitable<string> { 316 $hh_frame_metadata = $this->getHHFrameMetadata(); 317 if ($hh_frame_metadata !== null) { 318 \HH\set_frame_metadata($hh_frame_metadata); 319 } 320 await $this->asyncHandler_->genBefore("DbMixedStackArguments", "getDataByKey0"); 321 $currentseqid = $this->sendImpl_getDataByKey0($key); 322 $channel = $this->channel_; 323 $out_transport = $this->output_->getTransport(); 324 $in_transport = $this->input_->getTransport(); 325 if ($channel !== null && $out_transport is \TMemoryBuffer && $in_transport is \TMemoryBuffer) { 326 $msg = $out_transport->getBuffer(); 327 $out_transport->resetBuffer(); 328 list($result_msg, $_read_headers) = await $channel->genSendRequestResponse(new \RpcOptions(), $msg); 329 $in_transport->resetBuffer(); 330 $in_transport->write($result_msg); 331 } else { 332 await $this->asyncHandler_->genWait($currentseqid); 333 } 334 return $this->recvImpl_getDataByKey0($currentseqid); 335 } 336 337 /** 338 * Original thrift definition:- 339 * binary 340 * getDataByKey1(1: string key); 341 */ 342 public async function getDataByKey1(string $key): Awaitable<string> { 343 $hh_frame_metadata = $this->getHHFrameMetadata(); 344 if ($hh_frame_metadata !== null) { 345 \HH\set_frame_metadata($hh_frame_metadata); 346 } 347 await $this->asyncHandler_->genBefore("DbMixedStackArguments", "getDataByKey1"); 348 $currentseqid = $this->sendImpl_getDataByKey1($key); 349 $channel = $this->channel_; 350 $out_transport = $this->output_->getTransport(); 351 $in_transport = $this->input_->getTransport(); 352 if ($channel !== null && $out_transport is \TMemoryBuffer && $in_transport is \TMemoryBuffer) { 353 $msg = $out_transport->getBuffer(); 354 $out_transport->resetBuffer(); 355 list($result_msg, $_read_headers) = await $channel->genSendRequestResponse(new \RpcOptions(), $msg); 356 $in_transport->resetBuffer(); 357 $in_transport->write($result_msg); 358 } else { 359 await $this->asyncHandler_->genWait($currentseqid); 360 } 361 return $this->recvImpl_getDataByKey1($currentseqid); 362 } 363 364} 365 366class DbMixedStackArgumentsClient extends \ThriftClientBase implements DbMixedStackArgumentsClientIf { 367 use DbMixedStackArgumentsClientBase; 368 369 /** 370 * Original thrift definition:- 371 * binary 372 * getDataByKey0(1: string key); 373 */ 374 public async function getDataByKey0(string $key): Awaitable<string> { 375 $hh_frame_metadata = $this->getHHFrameMetadata(); 376 if ($hh_frame_metadata !== null) { 377 \HH\set_frame_metadata($hh_frame_metadata); 378 } 379 await $this->asyncHandler_->genBefore("DbMixedStackArguments", "getDataByKey0"); 380 $currentseqid = $this->sendImpl_getDataByKey0($key); 381 $channel = $this->channel_; 382 $out_transport = $this->output_->getTransport(); 383 $in_transport = $this->input_->getTransport(); 384 if ($channel !== null && $out_transport is \TMemoryBuffer && $in_transport is \TMemoryBuffer) { 385 $msg = $out_transport->getBuffer(); 386 $out_transport->resetBuffer(); 387 list($result_msg, $_read_headers) = await $channel->genSendRequestResponse(new \RpcOptions(), $msg); 388 $in_transport->resetBuffer(); 389 $in_transport->write($result_msg); 390 } else { 391 await $this->asyncHandler_->genWait($currentseqid); 392 } 393 return $this->recvImpl_getDataByKey0($currentseqid); 394 } 395 396 /** 397 * Original thrift definition:- 398 * binary 399 * getDataByKey1(1: string key); 400 */ 401 public async function getDataByKey1(string $key): Awaitable<string> { 402 $hh_frame_metadata = $this->getHHFrameMetadata(); 403 if ($hh_frame_metadata !== null) { 404 \HH\set_frame_metadata($hh_frame_metadata); 405 } 406 await $this->asyncHandler_->genBefore("DbMixedStackArguments", "getDataByKey1"); 407 $currentseqid = $this->sendImpl_getDataByKey1($key); 408 $channel = $this->channel_; 409 $out_transport = $this->output_->getTransport(); 410 $in_transport = $this->input_->getTransport(); 411 if ($channel !== null && $out_transport is \TMemoryBuffer && $in_transport is \TMemoryBuffer) { 412 $msg = $out_transport->getBuffer(); 413 $out_transport->resetBuffer(); 414 list($result_msg, $_read_headers) = await $channel->genSendRequestResponse(new \RpcOptions(), $msg); 415 $in_transport->resetBuffer(); 416 $in_transport->write($result_msg); 417 } else { 418 await $this->asyncHandler_->genWait($currentseqid); 419 } 420 return $this->recvImpl_getDataByKey1($currentseqid); 421 } 422 423 /* send and recv functions */ 424 public function send_getDataByKey0(string $key): int { 425 return $this->sendImpl_getDataByKey0($key); 426 } 427 public function recv_getDataByKey0(?int $expectedsequenceid = null): string { 428 return $this->recvImpl_getDataByKey0($expectedsequenceid); 429 } 430 public function send_getDataByKey1(string $key): int { 431 return $this->sendImpl_getDataByKey1($key); 432 } 433 public function recv_getDataByKey1(?int $expectedsequenceid = null): string { 434 return $this->recvImpl_getDataByKey1($expectedsequenceid); 435 } 436} 437 438class DbMixedStackArgumentsAsyncRpcOptionsClient extends \ThriftClientBase implements DbMixedStackArgumentsAsyncRpcOptionsIf { 439 use DbMixedStackArgumentsClientBase; 440 441 /** 442 * Original thrift definition:- 443 * binary 444 * getDataByKey0(1: string key); 445 */ 446 public async function getDataByKey0(\RpcOptions $rpc_options, string $key): Awaitable<string> { 447 $hh_frame_metadata = $this->getHHFrameMetadata(); 448 if ($hh_frame_metadata !== null) { 449 \HH\set_frame_metadata($hh_frame_metadata); 450 } 451 await $this->asyncHandler_->genBefore("DbMixedStackArguments", "getDataByKey0"); 452 $currentseqid = $this->sendImpl_getDataByKey0($key); 453 $channel = $this->channel_; 454 $out_transport = $this->output_->getTransport(); 455 $in_transport = $this->input_->getTransport(); 456 if ($channel !== null && $out_transport is \TMemoryBuffer && $in_transport is \TMemoryBuffer) { 457 $msg = $out_transport->getBuffer(); 458 $out_transport->resetBuffer(); 459 list($result_msg, $_read_headers) = await $channel->genSendRequestResponse($rpc_options, $msg); 460 $in_transport->resetBuffer(); 461 $in_transport->write($result_msg); 462 } else { 463 await $this->asyncHandler_->genWait($currentseqid); 464 } 465 return $this->recvImpl_getDataByKey0($currentseqid); 466 } 467 468 /** 469 * Original thrift definition:- 470 * binary 471 * getDataByKey1(1: string key); 472 */ 473 public async function getDataByKey1(\RpcOptions $rpc_options, string $key): Awaitable<string> { 474 $hh_frame_metadata = $this->getHHFrameMetadata(); 475 if ($hh_frame_metadata !== null) { 476 \HH\set_frame_metadata($hh_frame_metadata); 477 } 478 await $this->asyncHandler_->genBefore("DbMixedStackArguments", "getDataByKey1"); 479 $currentseqid = $this->sendImpl_getDataByKey1($key); 480 $channel = $this->channel_; 481 $out_transport = $this->output_->getTransport(); 482 $in_transport = $this->input_->getTransport(); 483 if ($channel !== null && $out_transport is \TMemoryBuffer && $in_transport is \TMemoryBuffer) { 484 $msg = $out_transport->getBuffer(); 485 $out_transport->resetBuffer(); 486 list($result_msg, $_read_headers) = await $channel->genSendRequestResponse($rpc_options, $msg); 487 $in_transport->resetBuffer(); 488 $in_transport->write($result_msg); 489 } else { 490 await $this->asyncHandler_->genWait($currentseqid); 491 } 492 return $this->recvImpl_getDataByKey1($currentseqid); 493 } 494 495} 496 497abstract class DbMixedStackArgumentsAsyncProcessorBase extends \ThriftAsyncProcessor { 498 abstract const type TThriftIf as DbMixedStackArgumentsAsyncIf; 499 const classname<\IThriftServiceStaticMetadata> SERVICE_METADATA_CLASS = DbMixedStackArgumentsStaticMetadata::class; 500 501 protected async function process_getDataByKey0(int $seqid, \TProtocol $input, \TProtocol $output): Awaitable<void> { 502 $handler_ctx = $this->eventHandler_->getHandlerContext('getDataByKey0'); 503 $reply_type = \TMessageType::REPLY; 504 505 $this->eventHandler_->preRead($handler_ctx, 'getDataByKey0', dict[]); 506 507 if ($input is \TBinaryProtocolAccelerated) { 508 $args = \thrift_protocol_read_binary_struct($input, 'DbMixedStackArguments_getDataByKey0_args'); 509 } else if ($input is \TCompactProtocolAccelerated) { 510 $args = \thrift_protocol_read_compact_struct($input, 'DbMixedStackArguments_getDataByKey0_args'); 511 } else { 512 $args = DbMixedStackArguments_getDataByKey0_args::withDefaultValues(); 513 $args->read($input); 514 } 515 $input->readMessageEnd(); 516 $this->eventHandler_->postRead($handler_ctx, 'getDataByKey0', $args); 517 $result = DbMixedStackArguments_getDataByKey0_result::withDefaultValues(); 518 try { 519 $this->eventHandler_->preExec($handler_ctx, 'DbMixedStackArguments', 'getDataByKey0', $args); 520 $result->success = await $this->handler->getDataByKey0($args->key); 521 $this->eventHandler_->postExec($handler_ctx, 'getDataByKey0', $result); 522 } catch (\Exception $ex) { 523 $reply_type = \TMessageType::EXCEPTION; 524 $this->eventHandler_->handlerError($handler_ctx, 'getDataByKey0', $ex); 525 $result = new \TApplicationException($ex->getMessage()."\n".$ex->getTraceAsString()); 526 } 527 $this->eventHandler_->preWrite($handler_ctx, 'getDataByKey0', $result); 528 if ($output is \TBinaryProtocolAccelerated) 529 { 530 \thrift_protocol_write_binary($output, 'getDataByKey0', $reply_type, $result, $seqid, $output->isStrictWrite()); 531 } 532 else if ($output is \TCompactProtocolAccelerated) 533 { 534 \thrift_protocol_write_compact($output, 'getDataByKey0', $reply_type, $result, $seqid); 535 } 536 else 537 { 538 $output->writeMessageBegin("getDataByKey0", $reply_type, $seqid); 539 $result->write($output); 540 $output->writeMessageEnd(); 541 $output->getTransport()->flush(); 542 } 543 $this->eventHandler_->postWrite($handler_ctx, 'getDataByKey0', $result); 544 } 545 protected async function process_getDataByKey1(int $seqid, \TProtocol $input, \TProtocol $output): Awaitable<void> { 546 $handler_ctx = $this->eventHandler_->getHandlerContext('getDataByKey1'); 547 $reply_type = \TMessageType::REPLY; 548 549 $this->eventHandler_->preRead($handler_ctx, 'getDataByKey1', dict[]); 550 551 if ($input is \TBinaryProtocolAccelerated) { 552 $args = \thrift_protocol_read_binary_struct($input, 'DbMixedStackArguments_getDataByKey1_args'); 553 } else if ($input is \TCompactProtocolAccelerated) { 554 $args = \thrift_protocol_read_compact_struct($input, 'DbMixedStackArguments_getDataByKey1_args'); 555 } else { 556 $args = DbMixedStackArguments_getDataByKey1_args::withDefaultValues(); 557 $args->read($input); 558 } 559 $input->readMessageEnd(); 560 $this->eventHandler_->postRead($handler_ctx, 'getDataByKey1', $args); 561 $result = DbMixedStackArguments_getDataByKey1_result::withDefaultValues(); 562 try { 563 $this->eventHandler_->preExec($handler_ctx, 'DbMixedStackArguments', 'getDataByKey1', $args); 564 $result->success = await $this->handler->getDataByKey1($args->key); 565 $this->eventHandler_->postExec($handler_ctx, 'getDataByKey1', $result); 566 } catch (\Exception $ex) { 567 $reply_type = \TMessageType::EXCEPTION; 568 $this->eventHandler_->handlerError($handler_ctx, 'getDataByKey1', $ex); 569 $result = new \TApplicationException($ex->getMessage()."\n".$ex->getTraceAsString()); 570 } 571 $this->eventHandler_->preWrite($handler_ctx, 'getDataByKey1', $result); 572 if ($output is \TBinaryProtocolAccelerated) 573 { 574 \thrift_protocol_write_binary($output, 'getDataByKey1', $reply_type, $result, $seqid, $output->isStrictWrite()); 575 } 576 else if ($output is \TCompactProtocolAccelerated) 577 { 578 \thrift_protocol_write_compact($output, 'getDataByKey1', $reply_type, $result, $seqid); 579 } 580 else 581 { 582 $output->writeMessageBegin("getDataByKey1", $reply_type, $seqid); 583 $result->write($output); 584 $output->writeMessageEnd(); 585 $output->getTransport()->flush(); 586 } 587 $this->eventHandler_->postWrite($handler_ctx, 'getDataByKey1', $result); 588 } 589 protected async function process_getThriftServiceMetadata(int $seqid, \TProtocol $input, \TProtocol $output): Awaitable<void> { 590 $reply_type = \TMessageType::REPLY; 591 592 if ($input is \TBinaryProtocolAccelerated) { 593 $args = \thrift_protocol_read_binary_struct($input, '\tmeta_ThriftMetadataService_getThriftServiceMetadata_args'); 594 } else if ($input is \TCompactProtocolAccelerated) { 595 $args = \thrift_protocol_read_compact_struct($input, '\tmeta_ThriftMetadataService_getThriftServiceMetadata_args'); 596 } else { 597 $args = \tmeta_ThriftMetadataService_getThriftServiceMetadata_args::withDefaultValues(); 598 $args->read($input); 599 } 600 $input->readMessageEnd(); 601 $result = \tmeta_ThriftMetadataService_getThriftServiceMetadata_result::withDefaultValues(); 602 try { 603 $result->success = DbMixedStackArgumentsStaticMetadata::getServiceMetadataResponse(); 604 } catch (\Exception $ex) { 605 $reply_type = \TMessageType::EXCEPTION; 606 $result = new \TApplicationException($ex->getMessage()."\n".$ex->getTraceAsString()); 607 } 608 if ($output is \TBinaryProtocolAccelerated) 609 { 610 \thrift_protocol_write_binary($output, 'getThriftServiceMetadata', $reply_type, $result, $seqid, $output->isStrictWrite()); 611 } 612 else if ($output is \TCompactProtocolAccelerated) 613 { 614 \thrift_protocol_write_compact($output, 'getThriftServiceMetadata', $reply_type, $result, $seqid); 615 } 616 else 617 { 618 $output->writeMessageBegin("getThriftServiceMetadata", $reply_type, $seqid); 619 $result->write($output); 620 $output->writeMessageEnd(); 621 $output->getTransport()->flush(); 622 } 623 } 624} 625class DbMixedStackArgumentsAsyncProcessor extends DbMixedStackArgumentsAsyncProcessorBase { 626 const type TThriftIf = DbMixedStackArgumentsAsyncIf; 627} 628 629abstract class DbMixedStackArgumentsSyncProcessorBase extends \ThriftSyncProcessor { 630 abstract const type TThriftIf as DbMixedStackArgumentsIf; 631 const classname<\IThriftServiceStaticMetadata> SERVICE_METADATA_CLASS = DbMixedStackArgumentsStaticMetadata::class; 632 633 protected function process_getDataByKey0(int $seqid, \TProtocol $input, \TProtocol $output): void { 634 $handler_ctx = $this->eventHandler_->getHandlerContext('getDataByKey0'); 635 $reply_type = \TMessageType::REPLY; 636 637 $this->eventHandler_->preRead($handler_ctx, 'getDataByKey0', dict[]); 638 639 if ($input is \TBinaryProtocolAccelerated) { 640 $args = \thrift_protocol_read_binary_struct($input, 'DbMixedStackArguments_getDataByKey0_args'); 641 } else if ($input is \TCompactProtocolAccelerated) { 642 $args = \thrift_protocol_read_compact_struct($input, 'DbMixedStackArguments_getDataByKey0_args'); 643 } else { 644 $args = DbMixedStackArguments_getDataByKey0_args::withDefaultValues(); 645 $args->read($input); 646 } 647 $input->readMessageEnd(); 648 $this->eventHandler_->postRead($handler_ctx, 'getDataByKey0', $args); 649 $result = DbMixedStackArguments_getDataByKey0_result::withDefaultValues(); 650 try { 651 $this->eventHandler_->preExec($handler_ctx, 'DbMixedStackArguments', 'getDataByKey0', $args); 652 $result->success = $this->handler->getDataByKey0($args->key); 653 $this->eventHandler_->postExec($handler_ctx, 'getDataByKey0', $result); 654 } catch (\Exception $ex) { 655 $reply_type = \TMessageType::EXCEPTION; 656 $this->eventHandler_->handlerError($handler_ctx, 'getDataByKey0', $ex); 657 $result = new \TApplicationException($ex->getMessage()."\n".$ex->getTraceAsString()); 658 } 659 $this->eventHandler_->preWrite($handler_ctx, 'getDataByKey0', $result); 660 if ($output is \TBinaryProtocolAccelerated) 661 { 662 \thrift_protocol_write_binary($output, 'getDataByKey0', $reply_type, $result, $seqid, $output->isStrictWrite()); 663 } 664 else if ($output is \TCompactProtocolAccelerated) 665 { 666 \thrift_protocol_write_compact($output, 'getDataByKey0', $reply_type, $result, $seqid); 667 } 668 else 669 { 670 $output->writeMessageBegin("getDataByKey0", $reply_type, $seqid); 671 $result->write($output); 672 $output->writeMessageEnd(); 673 $output->getTransport()->flush(); 674 } 675 $this->eventHandler_->postWrite($handler_ctx, 'getDataByKey0', $result); 676 } 677 protected function process_getDataByKey1(int $seqid, \TProtocol $input, \TProtocol $output): void { 678 $handler_ctx = $this->eventHandler_->getHandlerContext('getDataByKey1'); 679 $reply_type = \TMessageType::REPLY; 680 681 $this->eventHandler_->preRead($handler_ctx, 'getDataByKey1', dict[]); 682 683 if ($input is \TBinaryProtocolAccelerated) { 684 $args = \thrift_protocol_read_binary_struct($input, 'DbMixedStackArguments_getDataByKey1_args'); 685 } else if ($input is \TCompactProtocolAccelerated) { 686 $args = \thrift_protocol_read_compact_struct($input, 'DbMixedStackArguments_getDataByKey1_args'); 687 } else { 688 $args = DbMixedStackArguments_getDataByKey1_args::withDefaultValues(); 689 $args->read($input); 690 } 691 $input->readMessageEnd(); 692 $this->eventHandler_->postRead($handler_ctx, 'getDataByKey1', $args); 693 $result = DbMixedStackArguments_getDataByKey1_result::withDefaultValues(); 694 try { 695 $this->eventHandler_->preExec($handler_ctx, 'DbMixedStackArguments', 'getDataByKey1', $args); 696 $result->success = $this->handler->getDataByKey1($args->key); 697 $this->eventHandler_->postExec($handler_ctx, 'getDataByKey1', $result); 698 } catch (\Exception $ex) { 699 $reply_type = \TMessageType::EXCEPTION; 700 $this->eventHandler_->handlerError($handler_ctx, 'getDataByKey1', $ex); 701 $result = new \TApplicationException($ex->getMessage()."\n".$ex->getTraceAsString()); 702 } 703 $this->eventHandler_->preWrite($handler_ctx, 'getDataByKey1', $result); 704 if ($output is \TBinaryProtocolAccelerated) 705 { 706 \thrift_protocol_write_binary($output, 'getDataByKey1', $reply_type, $result, $seqid, $output->isStrictWrite()); 707 } 708 else if ($output is \TCompactProtocolAccelerated) 709 { 710 \thrift_protocol_write_compact($output, 'getDataByKey1', $reply_type, $result, $seqid); 711 } 712 else 713 { 714 $output->writeMessageBegin("getDataByKey1", $reply_type, $seqid); 715 $result->write($output); 716 $output->writeMessageEnd(); 717 $output->getTransport()->flush(); 718 } 719 $this->eventHandler_->postWrite($handler_ctx, 'getDataByKey1', $result); 720 } 721 protected function process_getThriftServiceMetadata(int $seqid, \TProtocol $input, \TProtocol $output): void { 722 $reply_type = \TMessageType::REPLY; 723 724 if ($input is \TBinaryProtocolAccelerated) { 725 $args = \thrift_protocol_read_binary_struct($input, '\tmeta_ThriftMetadataService_getThriftServiceMetadata_args'); 726 } else if ($input is \TCompactProtocolAccelerated) { 727 $args = \thrift_protocol_read_compact_struct($input, '\tmeta_ThriftMetadataService_getThriftServiceMetadata_args'); 728 } else { 729 $args = \tmeta_ThriftMetadataService_getThriftServiceMetadata_args::withDefaultValues(); 730 $args->read($input); 731 } 732 $input->readMessageEnd(); 733 $result = \tmeta_ThriftMetadataService_getThriftServiceMetadata_result::withDefaultValues(); 734 try { 735 $result->success = DbMixedStackArgumentsStaticMetadata::getServiceMetadataResponse(); 736 } catch (\Exception $ex) { 737 $reply_type = \TMessageType::EXCEPTION; 738 $result = new \TApplicationException($ex->getMessage()."\n".$ex->getTraceAsString()); 739 } 740 if ($output is \TBinaryProtocolAccelerated) 741 { 742 \thrift_protocol_write_binary($output, 'getThriftServiceMetadata', $reply_type, $result, $seqid, $output->isStrictWrite()); 743 } 744 else if ($output is \TCompactProtocolAccelerated) 745 { 746 \thrift_protocol_write_compact($output, 'getThriftServiceMetadata', $reply_type, $result, $seqid); 747 } 748 else 749 { 750 $output->writeMessageBegin("getThriftServiceMetadata", $reply_type, $seqid); 751 $result->write($output); 752 $output->writeMessageEnd(); 753 $output->getTransport()->flush(); 754 } 755 } 756} 757class DbMixedStackArgumentsSyncProcessor extends DbMixedStackArgumentsSyncProcessorBase { 758 const type TThriftIf = DbMixedStackArgumentsIf; 759} 760// For backwards compatibility 761class DbMixedStackArgumentsProcessor extends DbMixedStackArgumentsSyncProcessor {} 762 763// HELPER FUNCTIONS AND STRUCTURES 764 765class DbMixedStackArguments_getDataByKey0_args implements \IThriftStruct, \IThriftShapishStruct { 766 use \ThriftSerializationTrait; 767 768 const dict<int, this::TFieldSpec> SPEC = dict[ 769 1 => shape( 770 'var' => 'key', 771 'type' => \TType::STRING, 772 ), 773 ]; 774 const dict<string, int> FIELDMAP = dict[ 775 'key' => 1, 776 ]; 777 778 const type TConstructorShape = shape( 779 ?'key' => ?string, 780 ); 781 782 const type TShape = shape( 783 'key' => string, 784 ... 785 ); 786 const int STRUCTURAL_ID = 4222184892931375562; 787 public string $key; 788 789 public function __construct(?string $key = null )[] { 790 $this->key = $key ?? ''; 791 } 792 793 public static function withDefaultValues()[]: this { 794 return new static(); 795 } 796 797 public static function fromShape(self::TConstructorShape $shape)[]: this { 798 return new static( 799 Shapes::idx($shape, 'key'), 800 ); 801 } 802 803 public function getName()[]: string { 804 return 'DbMixedStackArguments_getDataByKey0_args'; 805 } 806 807 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 808 return tmeta_ThriftStruct::fromShape( 809 shape( 810 "name" => "module.getDataByKey0_args", 811 "fields" => vec[ 812 tmeta_ThriftField::fromShape( 813 shape( 814 "id" => 1, 815 "type" => tmeta_ThriftType::fromShape( 816 shape( 817 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, 818 ) 819 ), 820 "name" => "key", 821 ) 822 ), 823 ], 824 "is_union" => false, 825 ) 826 ); 827 } 828 829 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 830 return shape( 831 'struct' => dict[], 832 'fields' => dict[ 833 ], 834 ); 835 } 836 837 public static function __fromShape(self::TShape $shape)[]: this { 838 return new static( 839 $shape['key'], 840 ); 841 } 842 843 public function __toShape()[]: self::TShape { 844 return shape( 845 'key' => $this->key, 846 ); 847 } 848 public function readFromJson(string $jsonText): void { 849 $parsed = json_decode($jsonText, true); 850 851 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 852 throw new \TProtocolException("Cannot parse the given json string."); 853 } 854 855 if (idx($parsed, 'key') !== null) { 856 $this->key = /* HH_FIXME[4110] */ $parsed['key']; 857 } 858 } 859 860} 861 862class DbMixedStackArguments_getDataByKey0_result implements \IThriftStruct { 863 use \ThriftSerializationTrait; 864 865 const dict<int, this::TFieldSpec> SPEC = dict[ 866 0 => shape( 867 'var' => 'success', 868 'type' => \TType::STRING, 869 ), 870 ]; 871 const dict<string, int> FIELDMAP = dict[ 872 'success' => 0, 873 ]; 874 875 const type TConstructorShape = shape( 876 ?'success' => ?string, 877 ); 878 879 const int STRUCTURAL_ID = 1365128170602685579; 880 public ?string $success; 881 882 public function __construct(?string $success = null )[] { 883 } 884 885 public static function withDefaultValues()[]: this { 886 return new static(); 887 } 888 889 public static function fromShape(self::TConstructorShape $shape)[]: this { 890 return new static( 891 Shapes::idx($shape, 'success'), 892 ); 893 } 894 895 public function getName()[]: string { 896 return 'DbMixedStackArguments_getDataByKey0_result'; 897 } 898 899 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 900 return tmeta_ThriftStruct::fromShape( 901 shape( 902 "name" => "module.DbMixedStackArguments_getDataByKey0_result", 903 "fields" => vec[ 904 tmeta_ThriftField::fromShape( 905 shape( 906 "id" => 0, 907 "type" => tmeta_ThriftType::fromShape( 908 shape( 909 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_BINARY_TYPE, 910 ) 911 ), 912 "name" => "success", 913 ) 914 ), 915 ], 916 "is_union" => false, 917 ) 918 ); 919 } 920 921 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 922 return shape( 923 'struct' => dict[], 924 'fields' => dict[ 925 ], 926 ); 927 } 928 929 public function readFromJson(string $jsonText): void { 930 $parsed = json_decode($jsonText, true); 931 932 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 933 throw new \TProtocolException("Cannot parse the given json string."); 934 } 935 936 if (idx($parsed, 'success') !== null) { 937 $this->success = /* HH_FIXME[4110] */ $parsed['success']; 938 } 939 } 940 941} 942 943class DbMixedStackArguments_getDataByKey1_args implements \IThriftStruct, \IThriftShapishStruct { 944 use \ThriftSerializationTrait; 945 946 const dict<int, this::TFieldSpec> SPEC = dict[ 947 1 => shape( 948 'var' => 'key', 949 'type' => \TType::STRING, 950 ), 951 ]; 952 const dict<string, int> FIELDMAP = dict[ 953 'key' => 1, 954 ]; 955 956 const type TConstructorShape = shape( 957 ?'key' => ?string, 958 ); 959 960 const type TShape = shape( 961 'key' => string, 962 ... 963 ); 964 const int STRUCTURAL_ID = 4222184892931375562; 965 public string $key; 966 967 public function __construct(?string $key = null )[] { 968 $this->key = $key ?? ''; 969 } 970 971 public static function withDefaultValues()[]: this { 972 return new static(); 973 } 974 975 public static function fromShape(self::TConstructorShape $shape)[]: this { 976 return new static( 977 Shapes::idx($shape, 'key'), 978 ); 979 } 980 981 public function getName()[]: string { 982 return 'DbMixedStackArguments_getDataByKey1_args'; 983 } 984 985 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 986 return tmeta_ThriftStruct::fromShape( 987 shape( 988 "name" => "module.getDataByKey1_args", 989 "fields" => vec[ 990 tmeta_ThriftField::fromShape( 991 shape( 992 "id" => 1, 993 "type" => tmeta_ThriftType::fromShape( 994 shape( 995 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, 996 ) 997 ), 998 "name" => "key", 999 ) 1000 ), 1001 ], 1002 "is_union" => false, 1003 ) 1004 ); 1005 } 1006 1007 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 1008 return shape( 1009 'struct' => dict[], 1010 'fields' => dict[ 1011 ], 1012 ); 1013 } 1014 1015 public static function __fromShape(self::TShape $shape)[]: this { 1016 return new static( 1017 $shape['key'], 1018 ); 1019 } 1020 1021 public function __toShape()[]: self::TShape { 1022 return shape( 1023 'key' => $this->key, 1024 ); 1025 } 1026 public function readFromJson(string $jsonText): void { 1027 $parsed = json_decode($jsonText, true); 1028 1029 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 1030 throw new \TProtocolException("Cannot parse the given json string."); 1031 } 1032 1033 if (idx($parsed, 'key') !== null) { 1034 $this->key = /* HH_FIXME[4110] */ $parsed['key']; 1035 } 1036 } 1037 1038} 1039 1040class DbMixedStackArguments_getDataByKey1_result implements \IThriftStruct { 1041 use \ThriftSerializationTrait; 1042 1043 const dict<int, this::TFieldSpec> SPEC = dict[ 1044 0 => shape( 1045 'var' => 'success', 1046 'type' => \TType::STRING, 1047 ), 1048 ]; 1049 const dict<string, int> FIELDMAP = dict[ 1050 'success' => 0, 1051 ]; 1052 1053 const type TConstructorShape = shape( 1054 ?'success' => ?string, 1055 ); 1056 1057 const int STRUCTURAL_ID = 1365128170602685579; 1058 public ?string $success; 1059 1060 public function __construct(?string $success = null )[] { 1061 } 1062 1063 public static function withDefaultValues()[]: this { 1064 return new static(); 1065 } 1066 1067 public static function fromShape(self::TConstructorShape $shape)[]: this { 1068 return new static( 1069 Shapes::idx($shape, 'success'), 1070 ); 1071 } 1072 1073 public function getName()[]: string { 1074 return 'DbMixedStackArguments_getDataByKey1_result'; 1075 } 1076 1077 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 1078 return tmeta_ThriftStruct::fromShape( 1079 shape( 1080 "name" => "module.DbMixedStackArguments_getDataByKey1_result", 1081 "fields" => vec[ 1082 tmeta_ThriftField::fromShape( 1083 shape( 1084 "id" => 0, 1085 "type" => tmeta_ThriftType::fromShape( 1086 shape( 1087 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_BINARY_TYPE, 1088 ) 1089 ), 1090 "name" => "success", 1091 ) 1092 ), 1093 ], 1094 "is_union" => false, 1095 ) 1096 ); 1097 } 1098 1099 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 1100 return shape( 1101 'struct' => dict[], 1102 'fields' => dict[ 1103 ], 1104 ); 1105 } 1106 1107 public function readFromJson(string $jsonText): void { 1108 $parsed = json_decode($jsonText, true); 1109 1110 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 1111 throw new \TProtocolException("Cannot parse the given json string."); 1112 } 1113 1114 if (idx($parsed, 'success') !== null) { 1115 $this->success = /* HH_FIXME[4110] */ $parsed['success']; 1116 } 1117 } 1118 1119} 1120 1121class DbMixedStackArgumentsStaticMetadata implements \IThriftServiceStaticMetadata { 1122 public static function getServiceMetadata()[]: \tmeta_ThriftService { 1123 return tmeta_ThriftService::fromShape( 1124 shape( 1125 "name" => "module.DbMixedStackArguments", 1126 "functions" => vec[ 1127 tmeta_ThriftFunction::fromShape( 1128 shape( 1129 "name" => "getDataByKey0", 1130 "return_type" => tmeta_ThriftType::fromShape( 1131 shape( 1132 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_BINARY_TYPE, 1133 ) 1134 ), 1135 "arguments" => vec[ 1136 tmeta_ThriftField::fromShape( 1137 shape( 1138 "id" => 1, 1139 "type" => tmeta_ThriftType::fromShape( 1140 shape( 1141 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, 1142 ) 1143 ), 1144 "name" => "key", 1145 ) 1146 ), 1147 ], 1148 ) 1149 ), 1150 tmeta_ThriftFunction::fromShape( 1151 shape( 1152 "name" => "getDataByKey1", 1153 "return_type" => tmeta_ThriftType::fromShape( 1154 shape( 1155 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_BINARY_TYPE, 1156 ) 1157 ), 1158 "arguments" => vec[ 1159 tmeta_ThriftField::fromShape( 1160 shape( 1161 "id" => 1, 1162 "type" => tmeta_ThriftType::fromShape( 1163 shape( 1164 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, 1165 ) 1166 ), 1167 "name" => "key", 1168 ) 1169 ), 1170 ], 1171 ) 1172 ), 1173 ], 1174 ) 1175 ); 1176 } 1177 1178 public static function getServiceMetadataResponse()[]: \tmeta_ThriftServiceMetadataResponse { 1179 return \tmeta_ThriftServiceMetadataResponse::fromShape( 1180 shape( 1181 'context' => \tmeta_ThriftServiceContext::fromShape( 1182 shape( 1183 'service_info' => self::getServiceMetadata(), 1184 'module' => \tmeta_ThriftModuleContext::fromShape( 1185 shape( 1186 'name' => 'module', 1187 ) 1188 ), 1189 ) 1190 ), 1191 'metadata' => \tmeta_ThriftMetadata::fromShape( 1192 shape( 1193 'enums' => dict[ 1194 ], 1195 'structs' => dict[ 1196 ], 1197 'exceptions' => dict[ 1198 ], 1199 'services' => dict[ 1200 ], 1201 ) 1202 ), 1203 ) 1204 ); 1205 } 1206 1207 public static function getAllStructuredAnnotations()[]: \TServiceAnnotations { 1208 return shape( 1209 'service' => dict[], 1210 'functions' => dict[ 1211 ], 1212 ); 1213 } 1214} 1215 1216