SummaryService.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. <?php
  2. namespace OpenSearch\Generated\Summary;
  3. /**
  4. * Autogenerated by Thrift Compiler (0.10.0)
  5. *
  6. * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  7. * @generated
  8. */
  9. use Thrift\Base\TBase;
  10. use Thrift\Type\TType;
  11. use Thrift\Type\TMessageType;
  12. use Thrift\Exception\TException;
  13. use Thrift\Exception\TProtocolException;
  14. use Thrift\Protocol\TProtocol;
  15. use Thrift\Protocol\TBinaryProtocolAccelerated;
  16. use Thrift\Exception\TApplicationException;
  17. interface SummaryServiceIf {
  18. /**
  19. * @param string $appId
  20. * @param string $group
  21. * @return \OpenSearch\Generated\Summary\Summary[]
  22. * @throws \OpenSearch\Generated\Common\OpenSearchException
  23. * @throws \OpenSearch\Generated\Common\OpenSearchClientException
  24. */
  25. public function listByAppIdAndGroup($appId, $group);
  26. }
  27. class SummaryServiceClient implements \OpenSearch\Generated\Summary\SummaryServiceIf {
  28. protected $input_ = null;
  29. protected $output_ = null;
  30. protected $seqid_ = 0;
  31. public function __construct($input, $output=null) {
  32. $this->input_ = $input;
  33. $this->output_ = $output ? $output : $input;
  34. }
  35. public function listByAppIdAndGroup($appId, $group)
  36. {
  37. $this->send_listByAppIdAndGroup($appId, $group);
  38. return $this->recv_listByAppIdAndGroup();
  39. }
  40. public function send_listByAppIdAndGroup($appId, $group)
  41. {
  42. $args = new \OpenSearch\Generated\Summary\SummaryService_listByAppIdAndGroup_args();
  43. $args->appId = $appId;
  44. $args->group = $group;
  45. $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
  46. if ($bin_accel)
  47. {
  48. thrift_protocol_write_binary($this->output_, 'listByAppIdAndGroup', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
  49. }
  50. else
  51. {
  52. $this->output_->writeMessageBegin('listByAppIdAndGroup', TMessageType::CALL, $this->seqid_);
  53. $args->write($this->output_);
  54. $this->output_->writeMessageEnd();
  55. $this->output_->getTransport()->flush();
  56. }
  57. }
  58. public function recv_listByAppIdAndGroup()
  59. {
  60. $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
  61. if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\OpenSearch\Generated\Summary\SummaryService_listByAppIdAndGroup_result', $this->input_->isStrictRead());
  62. else
  63. {
  64. $rseqid = 0;
  65. $fname = null;
  66. $mtype = 0;
  67. $this->input_->readMessageBegin($fname, $mtype, $rseqid);
  68. if ($mtype == TMessageType::EXCEPTION) {
  69. $x = new TApplicationException();
  70. $x->read($this->input_);
  71. $this->input_->readMessageEnd();
  72. throw $x;
  73. }
  74. $result = new \OpenSearch\Generated\Summary\SummaryService_listByAppIdAndGroup_result();
  75. $result->read($this->input_);
  76. $this->input_->readMessageEnd();
  77. }
  78. if ($result->success !== null) {
  79. return $result->success;
  80. }
  81. if ($result->error !== null) {
  82. throw $result->error;
  83. }
  84. if ($result->e !== null) {
  85. throw $result->e;
  86. }
  87. throw new \Exception("listByAppIdAndGroup failed: unknown result");
  88. }
  89. }
  90. // HELPER FUNCTIONS AND STRUCTURES
  91. class SummaryService_listByAppIdAndGroup_args {
  92. static $_TSPEC;
  93. /**
  94. * @var string
  95. */
  96. public $appId = null;
  97. /**
  98. * @var string
  99. */
  100. public $group = null;
  101. public function __construct($vals=null) {
  102. if (!isset(self::$_TSPEC)) {
  103. self::$_TSPEC = array(
  104. 1 => array(
  105. 'var' => 'appId',
  106. 'type' => TType::STRING,
  107. ),
  108. 2 => array(
  109. 'var' => 'group',
  110. 'type' => TType::STRING,
  111. ),
  112. );
  113. }
  114. if (is_array($vals)) {
  115. if (isset($vals['appId'])) {
  116. $this->appId = $vals['appId'];
  117. }
  118. if (isset($vals['group'])) {
  119. $this->group = $vals['group'];
  120. }
  121. }
  122. }
  123. public function getName() {
  124. return 'SummaryService_listByAppIdAndGroup_args';
  125. }
  126. public function read($input)
  127. {
  128. $xfer = 0;
  129. $fname = null;
  130. $ftype = 0;
  131. $fid = 0;
  132. $xfer += $input->readStructBegin($fname);
  133. while (true)
  134. {
  135. $xfer += $input->readFieldBegin($fname, $ftype, $fid);
  136. if ($ftype == TType::STOP) {
  137. break;
  138. }
  139. switch ($fid)
  140. {
  141. case 1:
  142. if ($ftype == TType::STRING) {
  143. $xfer += $input->readString($this->appId);
  144. } else {
  145. $xfer += $input->skip($ftype);
  146. }
  147. break;
  148. case 2:
  149. if ($ftype == TType::STRING) {
  150. $xfer += $input->readString($this->group);
  151. } else {
  152. $xfer += $input->skip($ftype);
  153. }
  154. break;
  155. default:
  156. $xfer += $input->skip($ftype);
  157. break;
  158. }
  159. $xfer += $input->readFieldEnd();
  160. }
  161. $xfer += $input->readStructEnd();
  162. return $xfer;
  163. }
  164. public function write($output) {
  165. $xfer = 0;
  166. $xfer += $output->writeStructBegin('SummaryService_listByAppIdAndGroup_args');
  167. if ($this->appId !== null) {
  168. $xfer += $output->writeFieldBegin('appId', TType::STRING, 1);
  169. $xfer += $output->writeString($this->appId);
  170. $xfer += $output->writeFieldEnd();
  171. }
  172. if ($this->group !== null) {
  173. $xfer += $output->writeFieldBegin('group', TType::STRING, 2);
  174. $xfer += $output->writeString($this->group);
  175. $xfer += $output->writeFieldEnd();
  176. }
  177. $xfer += $output->writeFieldStop();
  178. $xfer += $output->writeStructEnd();
  179. return $xfer;
  180. }
  181. }
  182. class SummaryService_listByAppIdAndGroup_result {
  183. static $_TSPEC;
  184. /**
  185. * @var \OpenSearch\Generated\Summary\Summary[]
  186. */
  187. public $success = null;
  188. /**
  189. * @var \OpenSearch\Generated\Common\OpenSearchException
  190. */
  191. public $error = null;
  192. /**
  193. * @var \OpenSearch\Generated\Common\OpenSearchClientException
  194. */
  195. public $e = null;
  196. public function __construct($vals=null) {
  197. if (!isset(self::$_TSPEC)) {
  198. self::$_TSPEC = array(
  199. 0 => array(
  200. 'var' => 'success',
  201. 'type' => TType::LST,
  202. 'etype' => TType::STRUCT,
  203. 'elem' => array(
  204. 'type' => TType::STRUCT,
  205. 'class' => '\OpenSearch\Generated\Summary\Summary',
  206. ),
  207. ),
  208. 1 => array(
  209. 'var' => 'error',
  210. 'type' => TType::STRUCT,
  211. 'class' => '\OpenSearch\Generated\Common\OpenSearchException',
  212. ),
  213. 2 => array(
  214. 'var' => 'e',
  215. 'type' => TType::STRUCT,
  216. 'class' => '\OpenSearch\Generated\Common\OpenSearchClientException',
  217. ),
  218. );
  219. }
  220. if (is_array($vals)) {
  221. if (isset($vals['success'])) {
  222. $this->success = $vals['success'];
  223. }
  224. if (isset($vals['error'])) {
  225. $this->error = $vals['error'];
  226. }
  227. if (isset($vals['e'])) {
  228. $this->e = $vals['e'];
  229. }
  230. }
  231. }
  232. public function getName() {
  233. return 'SummaryService_listByAppIdAndGroup_result';
  234. }
  235. public function read($input)
  236. {
  237. $xfer = 0;
  238. $fname = null;
  239. $ftype = 0;
  240. $fid = 0;
  241. $xfer += $input->readStructBegin($fname);
  242. while (true)
  243. {
  244. $xfer += $input->readFieldBegin($fname, $ftype, $fid);
  245. if ($ftype == TType::STOP) {
  246. break;
  247. }
  248. switch ($fid)
  249. {
  250. case 0:
  251. if ($ftype == TType::LST) {
  252. $this->success = array();
  253. $_size0 = 0;
  254. $_etype3 = 0;
  255. $xfer += $input->readListBegin($_etype3, $_size0);
  256. for ($_i4 = 0; $_i4 < $_size0; ++$_i4)
  257. {
  258. $elem5 = null;
  259. $elem5 = new \OpenSearch\Generated\Summary\Summary();
  260. $xfer += $elem5->read($input);
  261. $this->success []= $elem5;
  262. }
  263. $xfer += $input->readListEnd();
  264. } else {
  265. $xfer += $input->skip($ftype);
  266. }
  267. break;
  268. case 1:
  269. if ($ftype == TType::STRUCT) {
  270. $this->error = new \OpenSearch\Generated\Common\OpenSearchException();
  271. $xfer += $this->error->read($input);
  272. } else {
  273. $xfer += $input->skip($ftype);
  274. }
  275. break;
  276. case 2:
  277. if ($ftype == TType::STRUCT) {
  278. $this->e = new \OpenSearch\Generated\Common\OpenSearchClientException();
  279. $xfer += $this->e->read($input);
  280. } else {
  281. $xfer += $input->skip($ftype);
  282. }
  283. break;
  284. default:
  285. $xfer += $input->skip($ftype);
  286. break;
  287. }
  288. $xfer += $input->readFieldEnd();
  289. }
  290. $xfer += $input->readStructEnd();
  291. return $xfer;
  292. }
  293. public function write($output) {
  294. $xfer = 0;
  295. $xfer += $output->writeStructBegin('SummaryService_listByAppIdAndGroup_result');
  296. if ($this->success !== null) {
  297. if (!is_array($this->success)) {
  298. throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
  299. }
  300. $xfer += $output->writeFieldBegin('success', TType::LST, 0);
  301. {
  302. $output->writeListBegin(TType::STRUCT, count($this->success));
  303. {
  304. foreach ($this->success as $iter6)
  305. {
  306. $xfer += $iter6->write($output);
  307. }
  308. }
  309. $output->writeListEnd();
  310. }
  311. $xfer += $output->writeFieldEnd();
  312. }
  313. if ($this->error !== null) {
  314. $xfer += $output->writeFieldBegin('error', TType::STRUCT, 1);
  315. $xfer += $this->error->write($output);
  316. $xfer += $output->writeFieldEnd();
  317. }
  318. if ($this->e !== null) {
  319. $xfer += $output->writeFieldBegin('e', TType::STRUCT, 2);
  320. $xfer += $this->e->write($output);
  321. $xfer += $output->writeFieldEnd();
  322. }
  323. $xfer += $output->writeFieldStop();
  324. $xfer += $output->writeStructEnd();
  325. return $xfer;
  326. }
  327. }
  328. class SummaryServiceProcessor {
  329. protected $handler_ = null;
  330. public function __construct($handler) {
  331. $this->handler_ = $handler;
  332. }
  333. public function process($input, $output) {
  334. $rseqid = 0;
  335. $fname = null;
  336. $mtype = 0;
  337. $input->readMessageBegin($fname, $mtype, $rseqid);
  338. $methodname = 'process_'.$fname;
  339. if (!method_exists($this, $methodname)) {
  340. $input->skip(TType::STRUCT);
  341. $input->readMessageEnd();
  342. $x = new TApplicationException('Function '.$fname.' not implemented.', TApplicationException::UNKNOWN_METHOD);
  343. $output->writeMessageBegin($fname, TMessageType::EXCEPTION, $rseqid);
  344. $x->write($output);
  345. $output->writeMessageEnd();
  346. $output->getTransport()->flush();
  347. return;
  348. }
  349. $this->$methodname($rseqid, $input, $output);
  350. return true;
  351. }
  352. protected function process_listByAppIdAndGroup($seqid, $input, $output) {
  353. $args = new \OpenSearch\Generated\Summary\SummaryService_listByAppIdAndGroup_args();
  354. $args->read($input);
  355. $input->readMessageEnd();
  356. $result = new \OpenSearch\Generated\Summary\SummaryService_listByAppIdAndGroup_result();
  357. try {
  358. $result->success = $this->handler_->listByAppIdAndGroup($args->appId, $args->group);
  359. } catch (\OpenSearch\Generated\Common\OpenSearchException $error) {
  360. $result->error = $error;
  361. } catch (\OpenSearch\Generated\Common\OpenSearchClientException $e) {
  362. $result->e = $e;
  363. }
  364. $bin_accel = ($output instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
  365. if ($bin_accel)
  366. {
  367. thrift_protocol_write_binary($output, 'listByAppIdAndGroup', TMessageType::REPLY, $result, $seqid, $output->isStrictWrite());
  368. }
  369. else
  370. {
  371. $output->writeMessageBegin('listByAppIdAndGroup', TMessageType::REPLY, $seqid);
  372. $result->write($output);
  373. $output->writeMessageEnd();
  374. $output->getTransport()->flush();
  375. }
  376. }
  377. }