summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/lib/Elastica/Transport/Thrift.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Transport/Thrift.php')
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Transport/Thrift.php53
1 files changed, 28 insertions, 25 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Transport/Thrift.php b/vendor/ruflin/elastica/lib/Elastica/Transport/Thrift.php
index f58c51a2..5790f665 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Transport/Thrift.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Transport/Thrift.php
@@ -1,7 +1,7 @@
<?php
-
namespace Elastica\Transport;
+use Elastica\Connection;
use Elastica\Exception\Connection\ThriftException;
use Elastica\Exception\PartialShardFailureException;
use Elastica\Exception\ResponseException;
@@ -9,23 +9,22 @@ use Elastica\Exception\RuntimeException;
use Elastica\JSON;
use Elastica\Request;
use Elastica\Response;
-use Elastica\Connection;
use Elasticsearch\Method;
-use Elasticsearch\RestResponse;
use Elasticsearch\RestClient;
use Elasticsearch\RestRequest;
-use Thrift\Transport\TSocket;
-use Thrift\Transport\TFramedTransport;
-use Thrift\Transport\TBufferedTransport;
-use Thrift\Protocol\TBinaryProtocolAccelerated;
+use Elasticsearch\RestResponse;
use Thrift\Exception\TException;
+use Thrift\Protocol\TBinaryProtocolAccelerated;
+use Thrift\Transport\TBufferedTransport;
+use Thrift\Transport\TFramedTransport;
+use Thrift\Transport\TSocket;
/**
- * Elastica Thrift Transport object
+ * Elastica Thrift Transport object.
*
- * @category Xodoa
- * @package Elastica
* @author Mikhail Shamin <munk13@gmail.com>
+ *
+ * @deprecated The thrift transport is deprecated as of ES 1.5, and will be removed in ES 2.0
*/
class Thrift extends AbstractTransport
{
@@ -35,9 +34,10 @@ class Thrift extends AbstractTransport
protected $_clients = array();
/**
- * Construct transport
+ * Construct transport.
*
* @param \Elastica\Connection $connection Connection object
+ *
* @throws \Elastica\Exception\RuntimeException
*/
public function __construct(Connection $connection = null)
@@ -50,10 +50,11 @@ class Thrift extends AbstractTransport
/**
* @param string $host
- * @param int $port
- * @param int $sendTimeout msec
- * @param int $recvTimeout msec
- * @param bool $framedTransport
+ * @param int $port
+ * @param int $sendTimeout msec
+ * @param int $recvTimeout msec
+ * @param bool $framedTransport
+ *
* @return \Elasticsearch\RestClient
*/
protected function _createClient($host, $port, $sendTimeout = null, $recvTimeout = null, $framedTransport = false)
@@ -84,28 +85,32 @@ class Thrift extends AbstractTransport
/**
* @param string $host
- * @param int $port
- * @param int $sendTimeout
- * @param int $recvTimeout
- * @param bool $framedTransport
+ * @param int $port
+ * @param int $sendTimeout
+ * @param int $recvTimeout
+ * @param bool $framedTransport
+ *
* @return \Elasticsearch\RestClient
*/
protected function _getClient($host, $port, $sendTimeout = null, $recvTimeout = null, $framedTransport = false)
{
- $key = $host . ':' . $port;
+ $key = $host.':'.$port;
if (!isset($this->_clients[$key])) {
$this->_clients[$key] = $this->_createClient($host, $port, $sendTimeout, $recvTimeout, $framedTransport);
}
+
return $this->_clients[$key];
}
/**
- * Makes calls to the elasticsearch server
+ * Makes calls to the elasticsearch server.
*
* @param \Elastica\Request $request
- * @param array $params Host, Port, ...
+ * @param array $params Host, Port, ...
+ *
* @throws \Elastica\Exception\Connection\ThriftException
* @throws \Elastica\Exception\ResponseException
+ *
* @return \Elastica\Response Response object
*/
public function exec(Request $request, array $params)
@@ -156,9 +161,7 @@ class Thrift extends AbstractTransport
throw new ThriftException($e, $request, $response);
}
- if (defined('DEBUG') && DEBUG) {
- $response->setQueryTime($end - $start);
- }
+ $response->setQueryTime($end - $start);
if ($response->hasError()) {
throw new ResponseException($request, $response);