Class: Solr::MasterSlave::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/solr/master_slave/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#disable_read_from_masterObject

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_enabledObject (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_urlObject

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_listObject



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_urlObject

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

Returns:

  • (Boolean)


16
17
18
# File 'lib/solr/master_slave/configuration.rb', line 16

def master_slave_enabled?
  @master_slave_enabled
end