diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-10-18 09:31:31 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-10-18 09:31:31 +0200 |
commit | 80f7dc77d430774192b929d780f96260066df2ee (patch) | |
tree | 102eaae7fc9ec567f2af76e96da3de2d1e83afcf /vendor/ruflin/elastica/lib/Elastica/Cluster | |
parent | cccd7bb4d819334c07e0dadaf16cbfdef31880e1 (diff) |
Update to MediaWiki 1.25.3
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Cluster')
4 files changed, 0 insertions, 635 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Cluster/Health.php b/vendor/ruflin/elastica/lib/Elastica/Cluster/Health.php deleted file mode 100644 index 18c77cfc..00000000 --- a/vendor/ruflin/elastica/lib/Elastica/Cluster/Health.php +++ /dev/null @@ -1,189 +0,0 @@ -<?php - -namespace Elastica\Cluster; -use Elastica\Client; -use Elastica\Cluster\Health\Index; -use Elastica\Request; - -/** - * Elastic cluster health. - * - * @package Elastica - * @author Ray Ward <ray.ward@bigcommerce.com> - * @link http://www.elasticsearch.org/guide/reference/api/admin-cluster-health.html - */ -class Health -{ - /** - * Elastica client. - * - * @var \Elastica\Client Client object - */ - protected $_client = null; - - /** - * The cluster health data. - * - * @var array - */ - protected $_data = null; - - /** - * @param \Elastica\Client $client The Elastica client. - */ - public function __construct(Client $client) - { - $this->_client = $client; - $this->refresh(); - } - - /** - * Retrieves the health data from the cluster. - * - * @return array - */ - protected function _retrieveHealthData() - { - $path = '_cluster/health?level=shards'; - $response = $this->_client->request($path, Request::GET); - - return $response->getData(); - } - - /** - * Gets the health data. - * - * @return array - */ - public function getData() - { - return $this->_data; - } - - /** - * Refreshes the health data for the cluster. - * - * @return \Elastica\Cluster\Health - */ - public function refresh() - { - $this->_data = $this->_retrieveHealthData(); - - return $this; - } - - /** - * Gets the name of the cluster. - * - * @return string - */ - public function getClusterName() - { - return $this->_data['cluster_name']; - } - - /** - * Gets the status of the cluster. - * - * @return string green, yellow or red. - */ - public function getStatus() - { - return $this->_data['status']; - } - - /** - * TODO determine the purpose of this. - * - * @return bool - */ - public function getTimedOut() - { - return $this->_data['timed_out']; - } - - /** - * Gets the number of nodes in the cluster. - * - * @return int - */ - public function getNumberOfNodes() - { - return $this->_data['number_of_nodes']; - } - - /** - * Gets the number of data nodes in the cluster. - * - * @return int - */ - public function getNumberOfDataNodes() - { - return $this->_data['number_of_data_nodes']; - } - - /** - * Gets the number of active primary shards. - * - * @return int - */ - public function getActivePrimaryShards() - { - return $this->_data['active_primary_shards']; - } - - /** - * Gets the number of active shards. - * - * @return int - */ - public function getActiveShards() - { - return $this->_data['active_shards']; - } - - /** - * Gets the number of relocating shards. - * - * @return int - */ - public function getRelocatingShards() - { - return $this->_data['relocating_shards']; - } - - /** - * Gets the number of initializing shards. - * - * @return int - */ - public function getInitializingShards() - { - return $this->_data['initializing_shards']; - } - - /** - * Gets the number of unassigned shards. - * - * @return int - */ - public function getUnassignedShards() - { - return $this->_data['unassigned_shards']; - } - - /** - * Gets the status of the indices. - * - * @return \Elastica\Cluster\Health\Index[] - */ - public function getIndices() - { - $indices = array(); - foreach ($this->_data['indices'] as $indexName => $index) { - $indices[] = new Index($indexName, $index); - } - - return $indices; - } -} diff --git a/vendor/ruflin/elastica/lib/Elastica/Cluster/Health/Index.php b/vendor/ruflin/elastica/lib/Elastica/Cluster/Health/Index.php deleted file mode 100644 index c39e94c3..00000000 --- a/vendor/ruflin/elastica/lib/Elastica/Cluster/Health/Index.php +++ /dev/null @@ -1,142 +0,0 @@ -<?php - -namespace Elastica\Cluster\Health; - -/** - * Wraps status information for an index. - * - * @package Elastica - * @author Ray Ward <ray.ward@bigcommerce.com> - * @link http://www.elasticsearch.org/guide/reference/api/admin-cluster-health.html - */ -class Index -{ - /** - * The name of the index. - * - * @var string - */ - protected $_name; - - /** - * The index health data. - * - * @var array - */ - protected $_data; - - /** - * @param string $name The name of the index. - * @param array $data The index health data. - */ - public function __construct($name, $data) - { - $this->_name = $name; - $this->_data = $data; - } - - /** - * Gets the name of the index. - * - * @return string - */ - public function getName() - { - return $this->_name; - } - - /** - * Gets the status of the index. - * - * @return string green, yellow or red. - */ - public function getStatus() - { - return $this->_data['status']; - } - - /** - * Gets the number of nodes in the index. - * - * @return int - */ - public function getNumberOfShards() - { - return $this->_data['number_of_shards']; - } - - /** - * Gets the number of data nodes in the index. - * - * @return int - */ - public function getNumberOfReplicas() - { - return $this->_data['number_of_replicas']; - } - - /** - * Gets the number of active primary shards. - * - * @return int - */ - public function getActivePrimaryShards() - { - return $this->_data['active_primary_shards']; - } - - /** - * Gets the number of active shards. - * - * @return int - */ - public function getActiveShards() - { - return $this->_data['active_shards']; - } - - /** - * Gets the number of relocating shards. - * - * @return int - */ - public function getRelocatingShards() - { - return $this->_data['relocating_shards']; - } - - /** - * Gets the number of initializing shards. - * - * @return int - */ - public function getInitializingShards() - { - return $this->_data['initializing_shards']; - } - - /** - * Gets the number of unassigned shards. - * - * @return int - */ - public function getUnassignedShards() - { - return $this->_data['unassigned_shards']; - } - - /** - * Gets the health of the shards in this index. - * - * @return \Elastica\Cluster\Health\Shard[] - */ - public function getShards() - { - $shards = array(); - foreach ($this->_data['shards'] as $shardNumber => $shard) { - $shards[] = new Shard($shardNumber, $shard); - } - - return $shards; - } -} diff --git a/vendor/ruflin/elastica/lib/Elastica/Cluster/Health/Shard.php b/vendor/ruflin/elastica/lib/Elastica/Cluster/Health/Shard.php deleted file mode 100644 index a5da08ae..00000000 --- a/vendor/ruflin/elastica/lib/Elastica/Cluster/Health/Shard.php +++ /dev/null @@ -1,107 +0,0 @@ -<?php - -namespace Elastica\Cluster\Health; - -/** - * Wraps status information for a shard. - * - * @package Elastica - * @author Ray Ward <ray.ward@bigcommerce.com> - * @link http://www.elasticsearch.org/guide/reference/api/admin-cluster-health.html - */ -class Shard -{ - /** - * The shard index/number. - * - * @var int - */ - protected $_shardNumber; - - /** - * The shard health data. - * - * @var array - */ - protected $_data; - - /** - * @param int $shardNumber The shard index/number. - * @param array $data The shard health data. - */ - public function __construct($shardNumber, $data) - { - $this->_shardNumber = $shardNumber; - $this->_data = $data; - } - - /** - * Gets the index/number of this shard. - * - * @return int - */ - public function getShardNumber() - { - return $this->_shardNumber; - } - - /** - * Gets the status of this shard. - * - * @return string green, yellow or red. - */ - public function getStatus() - { - return $this->_data['status']; - } - - /** - * Is the primary active? - * - * @return bool - */ - public function isPrimaryActive() - { - return $this->_data['primary_active']; - } - - /** - * Is this shard active? - * - * @return bool - */ - public function isActive() - { - return $this->_data['active_shards'] == 1; - } - - /** - * Is this shard relocating? - * - * @return bool - */ - public function isRelocating() - { - return $this->_data['relocating_shards'] == 1; - } - - /** - * Is this shard initialized? - * - * @return bool - */ - public function isInitialized() - { - return $this->_data['initializing_shards'] == 1; - } - - /** - * Is this shard unassigned? - * - * @return bool - */ - public function isUnassigned() - { - return $this->_data['unassigned_shards'] == 1; - } -} diff --git a/vendor/ruflin/elastica/lib/Elastica/Cluster/Settings.php b/vendor/ruflin/elastica/lib/Elastica/Cluster/Settings.php deleted file mode 100644 index 8166dda3..00000000 --- a/vendor/ruflin/elastica/lib/Elastica/Cluster/Settings.php +++ /dev/null @@ -1,197 +0,0 @@ -<?php - -namespace Elastica\Cluster; - -use Elastica\Client; -use Elastica\Request; - -/** - * Cluster settings - * - * @category Xodoa - * @package Elastica - * @author Nicolas Ruflin <spam@ruflin.com> - * @link http://www.elasticsearch.org/guide/reference/api/admin-cluster-update-settings.html - */ -class Settings -{ - /** - * Client - * - * @var \Elastica\Client Client object - */ - protected $_client = null; - - /** - * Creates a cluster object - * - * @param \Elastica\Client $client Connection client object - */ - public function __construct(Client $client) - { - $this->_client = $client; - } - - /** - * Returns settings data - * - * @return array Settings data (persistent and transient) - */ - public function get() - { - return $this->request()->getData(); - } - - /** - * Returns the current persistent settings of the cluster - * - * If param is set, only specified setting is return. - * - * @param string $setting OPTIONAL Setting name to return - * @return array|string|null Settings data - */ - public function getPersistent($setting = '') - { - $data = $this->get(); - $settings = $data['persistent']; - - if (!empty($setting)) { - if (isset($settings[$setting])) { - return $settings[$setting]; - } else { - return null; - } - } - - return $settings; - } - - /** - * Returns the current transient settings of the cluster - * - * If param is set, only specified setting is return. - * - * @param string $setting OPTIONAL Setting name to return - * @return array|string|null Settings data - */ - public function getTransient($setting = '') - { - $data = $this->get(); - $settings = $data['transient']; - - if (!empty($setting)) { - if (isset($settings[$setting])) { - return $settings[$setting]; - } else { - if (strpos($setting, '.') !== false) { - // convert dot notation to nested arrays - $keys = explode('.', $setting); - foreach ($keys as $key) { - if (isset($settings[$key])) { - $settings = $settings[$key]; - } else { - return null; - } - } - return $settings; - } - return null; - } - } - - return $settings; - } - - /** - * Sets persistent setting - * - * @param string $key - * @param string $value - * @return \Elastica\Response - */ - public function setPersistent($key, $value) - { - return $this->set( - array( - 'persistent' => array( - $key => $value - ) - ) - ); - } - - /** - * Sets transient settings - * - * @param string $key - * @param string $value - * @return \Elastica\Response - */ - public function setTransient($key, $value) - { - return $this->set( - array( - 'transient' => array( - $key => $value - ) - ) - ); - } - - /** - * Sets the cluster to read only - * - * Second param can be used to set it persistent - * - * @param bool $readOnly - * @param bool $persistent - * @return \Elastica\Response $response - */ - public function setReadOnly($readOnly = true, $persistent = false) - { - $key = 'cluster.blocks.read_only'; - - if ($persistent) { - $response = $this->setPersistent($key, $readOnly); - } else { - $response = $this->setTransient($key, $readOnly); - } - - return $response; - } - - /** - * Set settings for cluster - * - * @param array $settings Raw settings (including persistent or transient) - * @return \Elastica\Response - */ - public function set(array $settings) - { - return $this->request($settings, Request::PUT); - } - - /** - * Get the client - * - * @return \Elastica\Client - */ - public function getClient() - { - return $this->_client; - } - - /** - * Sends settings request - * - * @param array $data OPTIONAL Data array - * @param string $method OPTIONAL Transfer method (default = \Elastica\Request::GET) - * @return \Elastica\Response Response object - */ - public function request(array $data = array(), $method = Request::GET) - { - $path = '_cluster/settings'; - - return $this->getClient()->request($path, $method, $data); - } -} |