diff options
author | Andrew Dolgov <[email protected]> | 2023-04-09 20:50:33 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2023-04-09 20:50:33 +0300 |
commit | 8f3646a9c93a06f76f6abb31020fdb74b4b1fc59 (patch) | |
tree | 4e6c9f39e0623ef70bedfee014f1bd20603f89ad /vendor/packaged/thrift/src/Server/TServer.php | |
parent | a37eab2610a0a2bcb655258781c1c7e925dc94c0 (diff) |
exp: jaeger tracing
Diffstat (limited to 'vendor/packaged/thrift/src/Server/TServer.php')
-rw-r--r-- | vendor/packaged/thrift/src/Server/TServer.php | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/vendor/packaged/thrift/src/Server/TServer.php b/vendor/packaged/thrift/src/Server/TServer.php new file mode 100644 index 000000000..268c37820 --- /dev/null +++ b/vendor/packaged/thrift/src/Server/TServer.php @@ -0,0 +1,102 @@ +<?php + +namespace Thrift\Server; + +use Thrift\Factory\TTransportFactory; +use Thrift\Factory\TProtocolFactory; + +/** + * Generic class for a Thrift server. + * + * @package thrift.server + */ +abstract class TServer +{ + /** + * Processor to handle new clients + * + * @var TProcessor + */ + protected $processor_; + + /** + * Server transport to be used for listening + * and accepting new clients + * + * @var TServerTransport + */ + protected $transport_; + + /** + * Input transport factory + * + * @var TTransportFactory + */ + protected $inputTransportFactory_; + + /** + * Output transport factory + * + * @var TTransportFactory + */ + protected $outputTransportFactory_; + + /** + * Input protocol factory + * + * @var TProtocolFactory + */ + protected $inputProtocolFactory_; + + /** + * Output protocol factory + * + * @var TProtocolFactory + */ + protected $outputProtocolFactory_; + + /** + * Sets up all the factories, etc + * + * @param object $processor + * @param TServerTransport $transport + * @param TTransportFactory $inputTransportFactory + * @param TTransportFactory $outputTransportFactory + * @param TProtocolFactory $inputProtocolFactory + * @param TProtocolFactory $outputProtocolFactory + * @return void + */ + public function __construct( + $processor, + TServerTransport $transport, + TTransportFactory $inputTransportFactory, + TTransportFactory $outputTransportFactory, + TProtocolFactory $inputProtocolFactory, + TProtocolFactory $outputProtocolFactory + ) { + $this->processor_ = $processor; + $this->transport_ = $transport; + $this->inputTransportFactory_ = $inputTransportFactory; + $this->outputTransportFactory_ = $outputTransportFactory; + $this->inputProtocolFactory_ = $inputProtocolFactory; + $this->outputProtocolFactory_ = $outputProtocolFactory; + } + + /** + * Serves the server. This should never return + * unless a problem permits it to do so or it + * is interrupted intentionally + * + * @abstract + * @return void + */ + abstract public function serve(); + + /** + * Stops the server serving + * + * @abstract + * @return void + */ + abstract public function stop(); +} |