Class: LucidWorks::Cluster::Node
- Inherits:
-
Object
- Object
- LucidWorks::Cluster::Node
- Includes:
- ActiveModel::Serializers::JSON
- Defined in:
- lib/lucid_works/cluster.rb
Instance Attribute Summary collapse
-
#api_url ⇒ Object
readonly
Returns the value of attribute api_url.
-
#cluster ⇒ Object
readonly
Returns the value of attribute cluster.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#shards ⇒ Object
Returns the value of attribute shards.
-
#solr_url ⇒ Object
readonly
Returns the value of attribute solr_url.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(cluster, solr_url, state) ⇒ Node
constructor
A new instance of Node.
Constructor Details
#initialize(cluster, solr_url, state) ⇒ Node
Returns a new instance of Node.
12 13 14 15 16 17 18 19 |
# File 'lib/lucid_works/cluster.rb', line 12 def initialize(cluster, solr_url, state) @cluster, @solr_url, @state = cluster, solr_url, state uri = URI(solr_url) @host, @port = uri.host, uri.port @id = "#{host}_#{port}" @api_url = solr_url.sub uri.path, '/api' @shards = [] end |
Instance Attribute Details
#api_url ⇒ Object (readonly)
Returns the value of attribute api_url.
9 10 11 |
# File 'lib/lucid_works/cluster.rb', line 9 def api_url @api_url end |
#cluster ⇒ Object (readonly)
Returns the value of attribute cluster.
9 10 11 |
# File 'lib/lucid_works/cluster.rb', line 9 def cluster @cluster end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
9 10 11 |
# File 'lib/lucid_works/cluster.rb', line 9 def host @host end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
9 10 11 |
# File 'lib/lucid_works/cluster.rb', line 9 def id @id end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
9 10 11 |
# File 'lib/lucid_works/cluster.rb', line 9 def port @port end |
#shards ⇒ Object
Returns the value of attribute shards.
10 11 12 |
# File 'lib/lucid_works/cluster.rb', line 10 def shards @shards end |
#solr_url ⇒ Object (readonly)
Returns the value of attribute solr_url.
9 10 11 |
# File 'lib/lucid_works/cluster.rb', line 9 def solr_url @solr_url end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
9 10 11 |
# File 'lib/lucid_works/cluster.rb', line 9 def state @state end |
Instance Method Details
#as_json(options = {}) ⇒ Object
21 22 23 |
# File 'lib/lucid_works/cluster.rb', line 21 def as_json( = {}) {'id' => id, 'host' => host, 'port' => port, 'state' => state, 'solr_url' => solr_url, 'api_url' => api_url, 'shards' => shards} end |