Class: Neo4j::Core::Index::IndexerRegistry

Inherits:
Object
  • Object
show all
Defined in:
lib/neo4j-core/index/indexer_registry.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeIndexerRegistry

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

.instanceObject



47
48
49
# File 'lib/neo4j-core/index/indexer_registry.rb', line 47

def instance
  @@instance ||= IndexerRegistry.new
end

Instance Method Details

#delete_all_indexesObject



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_shutdownObject



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