summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/lib/Elastica/Cluster/Health/Shard.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2015-12-17 09:15:42 +0100
committerPierre Schmitz <pierre@archlinux.de>2015-12-17 09:44:51 +0100
commita1789ddde42033f1b05cc4929491214ee6e79383 (patch)
tree63615735c4ddffaaabf2428946bb26f90899f7bf /vendor/ruflin/elastica/lib/Elastica/Cluster/Health/Shard.php
parent9e06a62f265e3a2aaabecc598d4bc617e06fa32d (diff)
Update to MediaWiki 1.26.0
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Cluster/Health/Shard.php')
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Cluster/Health/Shard.php102
1 files changed, 102 insertions, 0 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Cluster/Health/Shard.php b/vendor/ruflin/elastica/lib/Elastica/Cluster/Health/Shard.php
new file mode 100644
index 00000000..e1d2c8dc
--- /dev/null
+++ b/vendor/ruflin/elastica/lib/Elastica/Cluster/Health/Shard.php
@@ -0,0 +1,102 @@
+<?php
+namespace Elastica\Cluster\Health;
+
+/**
+ * Wraps status information for a shard.
+ *
+ * @author Ray Ward <ray.ward@bigcommerce.com>
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html
+ */
+class Shard
+{
+ /**
+ * @var int The shard index/number.
+ */
+ protected $_shardNumber;
+
+ /**
+ * @var array The shard health data.
+ */
+ 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;
+ }
+}