]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/jaegertracing/thrift/lib/php/lib/Server/TServerTransport.php
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / jaegertracing / thrift / lib / php / lib / Server / TServerTransport.php
diff --git a/ceph/src/jaegertracing/thrift/lib/php/lib/Server/TServerTransport.php b/ceph/src/jaegertracing/thrift/lib/php/lib/Server/TServerTransport.php
new file mode 100644 (file)
index 0000000..15a27af
--- /dev/null
@@ -0,0 +1,56 @@
+<?php
+
+namespace Thrift\Server;
+
+use Thrift\Exception\TTransportException;
+
+/**
+ * Generic class for Server agent.
+ *
+ * @package thrift.transport
+ */
+abstract class TServerTransport
+{
+    /**
+     * List for new clients
+     *
+     * @abstract
+     * @return void
+     */
+    abstract public function listen();
+
+    /**
+     * Close the server
+     *
+     * @abstract
+     * @return void
+     */
+    abstract public function close();
+
+    /**
+     * Subclasses should use this to implement
+     * accept.
+     *
+     * @abstract
+     * @return TTransport
+     */
+    abstract protected function acceptImpl();
+
+    /**
+     * Uses the accept implemtation. If null is returned, an
+     * exception is thrown.
+     *
+     * @throws TTransportException
+     * @return TTransport
+     */
+    public function accept()
+    {
+        $transport = $this->acceptImpl();
+
+        if ($transport == null) {
+            throw new TTransportException("accept() may not return NULL");
+        }
+
+        return $transport;
+    }
+}