Class: Tire::Cluster
Class Method Summary collapse
-
.host ⇒ Object
“cs2”:{“host”:“192.168.6.35”,“master”:false,“online”:false,“port”:9500,“cs1”:“host”:“192.168.6.35”,“master”:false,“online”:true,“port”:9400}.
-
.index ⇒ Object
[“news”,“blog”,“ask”].
-
.state(more = false) ⇒ Object
[“host”:“192.168.6.35”,“master”:false,“online”:false,“port”:9500,“host”:“192.168.6.35”,“master”:false,“online”:true,“port”:9400].
- .url ⇒ Object
Methods included from Utils
Class Method Details
.host ⇒ Object
“cs2”:{“host”:“192.168.6.35”,“master”:false,“online”:false,“port”:9500,“cs1”:“host”:“192.168.6.35”,“master”:false,“online”:true,“port”:9400}
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/tire/cluster.rb', line 41 def self.host path = "#{url}/_host" @response = Configuration.client.get(path) if @response.failure? STDERR.puts "[REQUEST FAILED] \n" raise @response.to_s end MultiJson.decode(@response.body) ensure curl = %Q|curl -X GET #{path}| logged('CLUSTER HOST', curl) end |
.index ⇒ Object
- “news”,“blog”,“ask”
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/tire/cluster.rb', line 25 def self.index desc_url = "#{url}/_index" @response = Configuration.client.get(desc_url) if @response.failure? STDERR.puts "[REQUEST FAILED] \n" raise @response.to_s end MultiJson.decode(@response.body) ensure curl = %Q|curl -X GET #{desc_url}| logged('CLUSTER INDEX', curl) end |
.state(more = false) ⇒ Object
- “host”:“192.168.6.35”,“master”:false,“online”:false,“port”:9500,“host”:“192.168.6.35”,“master”:false,“online”:true,“port”:9400
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/tire/cluster.rb', line 11 def self.state(more = false) desc_url = more ? "#{url}/_state?more=true" : "#{url}/_state?more=false" @response = Configuration.client.get(desc_url) if @response.success? MultiJson.decode(@response.body) else [] end ensure curl = %Q|curl -X GET #{desc_url}| logged('CLUSTER_STATE', curl) end |
.url ⇒ Object
6 7 8 |
# File 'lib/tire/cluster.rb', line 6 def self.url "#{Configuration.url}/cluster" end |