Module: Cellect::Client
- Defined in:
- lib/cellect/client.rb,
lib/cellect/testing.rb,
lib/cellect/client/node_set.rb,
lib/cellect/client/connection.rb
Defined Under Namespace
Classes: CellectServerError, Connection, NodeSet
Class Attribute Summary collapse
-
._node_set ⇒ Object
Returns the value of attribute _node_set.
-
.connection ⇒ Object
Returns the value of attribute connection.
Class Method Summary collapse
-
.choose_host ⇒ Object
Selects a server for a user.
-
.host_exists?(ip) ⇒ Boolean
Ensure a previously selected server is still available.
-
.mock_zookeeper? ⇒ Boolean
Disabled with lib/cellect/testing.rb.
-
.node_set(zk_url = nil) ⇒ Object
Sets up the set of server nodes.
- .ready? ⇒ Boolean
Class Attribute Details
._node_set ⇒ Object
Returns the value of attribute _node_set.
9 10 11 |
# File 'lib/cellect/client.rb', line 9 def _node_set @_node_set end |
.connection ⇒ Object
Returns the value of attribute connection.
9 10 11 |
# File 'lib/cellect/client.rb', line 9 def connection @connection end |
Class Method Details
.choose_host ⇒ Object
Selects a server for a user
28 29 30 |
# File 'lib/cellect/client.rb', line 28 def self.choose_host node_set.nodes.values.sample end |
.host_exists?(ip) ⇒ Boolean
Ensure a previously selected server is still available
33 34 35 |
# File 'lib/cellect/client.rb', line 33 def self.host_exists?(ip) node_set.nodes.values.include? ip end |
.mock_zookeeper? ⇒ Boolean
Disabled with lib/cellect/testing.rb
13 14 15 |
# File 'lib/cellect/client.rb', line 13 def self.mock_zookeeper? false end |
.node_set(zk_url = nil) ⇒ Object
Sets up the set of server nodes
18 19 20 21 |
# File 'lib/cellect/client.rb', line 18 def self.node_set(zk_url=nil) self._node_set ||= NodeSet.supervise(zk_url) _node_set.actors.first end |
.ready? ⇒ Boolean
23 24 25 |
# File 'lib/cellect/client.rb', line 23 def self.ready? node_set.ready? end |