Class: Solr::MasterSlave::Configuration
- Inherits:
-
Object
- Object
- Solr::MasterSlave::Configuration
- Defined in:
- lib/solr/master_slave/configuration.rb
Instance Attribute Summary collapse
-
#disable_read_from_master ⇒ Object
Returns the value of attribute disable_read_from_master.
-
#master_slave_enabled ⇒ Object
readonly
Returns the value of attribute master_slave_enabled.
-
#master_url ⇒ Object
Returns the value of attribute master_url.
- #nodes_gray_list ⇒ Object
-
#slave_url ⇒ Object
Returns the value of attribute slave_url.
Instance Method Summary collapse
- #active_nodes_for(collection:) ⇒ Object
- #enable_master_slave!(_) ⇒ Object
- #master_slave_enabled? ⇒ Boolean
Instance Attribute Details
#disable_read_from_master ⇒ Object
Returns the value of attribute disable_read_from_master.
7 8 9 |
# File 'lib/solr/master_slave/configuration.rb', line 7 def disable_read_from_master @disable_read_from_master end |
#master_slave_enabled ⇒ Object (readonly)
Returns the value of attribute master_slave_enabled.
9 10 11 |
# File 'lib/solr/master_slave/configuration.rb', line 9 def master_slave_enabled @master_slave_enabled end |
#master_url ⇒ Object
Returns the value of attribute master_url.
7 8 9 |
# File 'lib/solr/master_slave/configuration.rb', line 7 def master_url @master_url end |
#nodes_gray_list ⇒ Object
27 28 29 |
# File 'lib/solr/master_slave/configuration.rb', line 27 def nodes_gray_list @nodes_gray_list || gray_list_disabled_instance end |
#slave_url ⇒ Object
Returns the value of attribute slave_url.
7 8 9 |
# File 'lib/solr/master_slave/configuration.rb', line 7 def slave_url @slave_url end |
Instance Method Details
#active_nodes_for(collection:) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/solr/master_slave/configuration.rb', line 20 def active_nodes_for(collection:) urls = [] urls.push(master_url) unless disable_read_from_master urls.push(*slave_url) if slave_url nodes_gray_list.select_active(urls, collection_name: collection) end |
#enable_master_slave!(_) ⇒ Object
12 13 14 |
# File 'lib/solr/master_slave/configuration.rb', line 12 def enable_master_slave!(_) @master_slave_enabled = true end |
#master_slave_enabled? ⇒ Boolean
16 17 18 |
# File 'lib/solr/master_slave/configuration.rb', line 16 def master_slave_enabled? @master_slave_enabled end |