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.



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

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



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

def connection
  @connection
end

#nameString (readonly)

Returns the name of this configset.

Returns:

  • (String)

    the name of this configset



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

def name
  @name
end

Instance Method Details

#delete!Object

Delete this configset.

Returns:

  • The underlying connection

See Also:



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

def delete!
  connection.delete_configset(name)
  connection
end

#in_use?Boolean

Are there any collections currently using this configset?

Returns:

  • (Boolean)


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

def in_use?
  !used_by.empty?
end

#inspectObject Also known as: to_s



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

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

#pretty_print(q) ⇒ Object



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

def pretty_print(q)
  q.text inspect
end

#used_byArray<Collection> Also known as: collections

Which collections use this configset?

Returns:

  • (Array<Collection>)

    The collections defined to use this configset



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

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