Class: Neo4j::Core::Index::IndexerRegistry
- Inherits:
-
Object
- Object
- Neo4j::Core::Index::IndexerRegistry
- Defined in:
- lib/neo4j-core/index/indexer_registry.rb
Class Method Summary collapse
Instance Method Summary collapse
- #delete_all_indexes ⇒ Object
- #each_indexer(props) ⇒ Object
- #indexers_for(props) ⇒ Object
-
#initialize ⇒ IndexerRegistry
constructor
A new instance of IndexerRegistry.
- #on_neo4j_shutdown ⇒ Object
- #on_node_deleted(node, old_props) ⇒ Object
- #on_property_changed(node, field, old_val, new_val) ⇒ Object
- #on_rel_property_changed(rel, field, old_val, new_val) ⇒ Object
- #on_relationship_deleted(relationship, old_props) ⇒ Object
- #register(indexer) ⇒ Object
Constructor Details
#initialize ⇒ IndexerRegistry
Returns a new instance of IndexerRegistry.
5 6 7 |
# File 'lib/neo4j-core/index/indexer_registry.rb', line 5 def initialize @indexers = [] end |
Class Method Details
.instance ⇒ Object
47 48 49 |
# File 'lib/neo4j-core/index/indexer_registry.rb', line 47 def instance @@instance ||= IndexerRegistry.new end |
Instance Method Details
#delete_all_indexes ⇒ Object
9 10 11 |
# File 'lib/neo4j-core/index/indexer_registry.rb', line 9 def delete_all_indexes @indexers.each { |i| i.rm_index_type } end |
#each_indexer(props) ⇒ Object
22 23 24 |
# File 'lib/neo4j-core/index/indexer_registry.rb', line 22 def each_indexer(props) @indexers.each { |i| yield i if i.trigger_on?(props) } end |
#indexers_for(props) ⇒ Object
18 19 20 |
# File 'lib/neo4j-core/index/indexer_registry.rb', line 18 def indexers_for(props) Enumerator.new(self, :each_indexer, props) end |
#on_neo4j_shutdown ⇒ Object
42 43 44 |
# File 'lib/neo4j-core/index/indexer_registry.rb', line 42 def on_neo4j_shutdown(*) @indexers.each { |indexer| indexer.on_neo4j_shutdown } end |
#on_node_deleted(node, old_props) ⇒ Object
26 27 28 |
# File 'lib/neo4j-core/index/indexer_registry.rb', line 26 def on_node_deleted(node, old_props, *) each_indexer(old_props) { |indexer| indexer.remove_index_on(node, old_props) } end |
#on_property_changed(node, field, old_val, new_val) ⇒ Object
30 31 32 |
# File 'lib/neo4j-core/index/indexer_registry.rb', line 30 def on_property_changed(node, field, old_val, new_val) each_indexer(node) { |indexer| indexer.update_index_on(node, field, old_val, new_val) } end |
#on_rel_property_changed(rel, field, old_val, new_val) ⇒ Object
38 39 40 |
# File 'lib/neo4j-core/index/indexer_registry.rb', line 38 def on_rel_property_changed(rel, field, old_val, new_val) each_indexer(rel) { |indexer| indexer.update_index_on(rel, field, old_val, new_val) } end |
#on_relationship_deleted(relationship, old_props) ⇒ Object
34 35 36 |
# File 'lib/neo4j-core/index/indexer_registry.rb', line 34 def on_relationship_deleted(relationship, old_props, *) each_indexer(old_props) { |indexer| indexer.remove_index_on(relationship, old_props) } end |
#register(indexer) ⇒ Object
13 14 15 16 |
# File 'lib/neo4j-core/index/indexer_registry.rb', line 13 def register(indexer) @indexers << indexer indexer end |