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

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, #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, #close, create_session, current, current!, #db_type, inspect, named, on_session_available, open, open_named, query, #query, register, register_db, #running, set_current, #shutdown, unregister, user_agent_string

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
# 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)

  fail Error, 'Need properties file for HA configuration' unless properties_file
  db_service.loadPropertiesFromFile(properties_file)
  @graph_db = db_service.newGraphDatabase
  Neo4j::Session._notify_listeners(:session_available, self)
end