Class: Neo4j::Embedded::EmbeddedHaSession

Inherits:
EmbeddedSession show all
Defined in:
lib/neo4j-embedded/embedded_ha_session.rb

Instance Attribute Summary

Attributes inherited from EmbeddedSession

#db_location, #graph_db, #properties_file, #properties_map

Instance Method Summary collapse

Methods inherited from EmbeddedSession

#_load_node, #_load_relationship, #_query, #_query_or_fail, #begin_tx, #close, #create_label, #create_node, #db_type, #factory_class, #find_all_nodes, #find_nodes, #indifferent_params, #initialize, #inspect, #load_node, #load_relationship, #query, #query_default_return, #running?, #search_result_to_enumerable, #shutdown, #version

Methods included from Core::TxMethods

#tx_methods

Methods inherited from Session

_listeners, _notify_listeners, #_query, add_listener, #auto_commit?, #begin_tx, clear_listeners, #close, create_session, current, current!, #db_type, inspect, named, on_next_session_available, open, query, #query, register, register_db, #running, set_current, #shutdown, unregister, user_agent_string, validate_session_num!

Constructor Details

This class inherits a constructor from Neo4j::Embedded::EmbeddedSession

Instance Method Details

#startObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/neo4j-embedded/embedded_ha_session.rb', line 10

def start
  fail Error, 'Embedded HA Neo4j db is already running' if running?
  puts "Start embedded HA Neo4j db at #{db_location}"
  factory    = Java::OrgNeo4jGraphdbFactory::HighlyAvailableGraphDatabaseFactory.new
  db_service = factory.newHighlyAvailableDatabaseBuilder(db_location)

  case
  when properties_file
    db_service.loadPropertiesFromFile(properties_file)
  when properties_map
    db_service.setConfig(properties_map)
  else
    fail Error, 'Need properties for HA configuration'
  end

  @graph_db = db_service.newGraphDatabase
  Neo4j::Session._notify_listeners(:session_available, self)
end