Class: SolrCloud::Configset

Inherits:
Object
  • Object
show all
Defined in:
lib/solr_cloud/configset.rb

Overview

A configset can’t do much by itself, other than try to delete itself and throw an error if that’s an illegal operation (because a collection is using it)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, connection:) ⇒ Configset

Returns a new instance of Configset.



17
18
19
20
# File 'lib/solr_cloud/configset.rb', line 17

def initialize(name:, connection:)
  @name = name
  @connection = connection
end

Instance Attribute Details

#connectionConnection (readonly)

Returns the connection object used to build this configset object.

Returns:

  • (Connection)

    the connection object used to build this configset object



15
16
17
# File 'lib/solr_cloud/configset.rb', line 15

def connection
  @connection
end

#nameString (readonly)

Returns the name of this configset.

Returns:

  • (String)

    the name of this configset



12
13
14
# File 'lib/solr_cloud/configset.rb', line 12

def name
  @name
end

Instance Method Details

#delete!Object

Delete this configset.

Returns:

  • The underlying connection

See Also:



25
26
27
28
# File 'lib/solr_cloud/configset.rb', line 25

def delete!
  connection.delete_configset(name)
  connection
end

#in_use?Boolean

Are there any collections currently using this configset?

Returns:

  • (Boolean)


38
39
40
# File 'lib/solr_cloud/configset.rb', line 38

def in_use?
  !used_by.empty?
end

#inspectObject Also known as: to_s



42
43
44
# File 'lib/solr_cloud/configset.rb', line 42

def inspect
  "<#{self.class.name} '#{name}' at #{connection.url}>"
end

#pretty_print(q) ⇒ Object



48
49
50
# File 'lib/solr_cloud/configset.rb', line 48

def pretty_print(q)
  q.text inspect
end

#used_byArray<Collection>

Which collections use this configset?

Returns:

  • (Array<Collection>)

    The collections defined to use this configset



32
33
34
# File 'lib/solr_cloud/configset.rb', line 32

def used_by
  connection.only_collections.select { |coll| coll.configset.name == name }
end