class Neo4j::Core::CypherSession::Transactions::Driver

Attributes

driver_session[R]
driver_tx[R]

Public Class Methods

new(*args) click to toggle source
Calls superclass method Neo4j::Transaction::Base::new
   # File lib/neo4j/core/cypher_session/transactions/driver.rb
10 def initialize(*args)
11   super
12   return unless root?
13   @driver_session = session.adaptor.driver.session(Neo4j::Driver::AccessMode::WRITE)
14   @driver_tx = @driver_session.begin_transaction
15 rescue StandardError => e
16   clean_transaction_registry
17   @driver_tx.close if @driver_tx
18   @driver_session.close if @driver_session
19   raise e
20 end

Public Instance Methods

commit() click to toggle source
   # File lib/neo4j/core/cypher_session/transactions/driver.rb
22 def commit
23   return unless root?
24   begin
25     @driver_tx.success
26     @driver_tx.close
27   ensure
28     @driver_session.close
29   end
30 end
delete() click to toggle source
   # File lib/neo4j/core/cypher_session/transactions/driver.rb
32 def delete
33   root.driver_tx.failure
34   root.driver_tx.close
35   root.driver_session.close
36 end
root_tx() click to toggle source
   # File lib/neo4j/core/cypher_session/transactions/driver.rb
42 def root_tx
43   root.driver_tx
44 end
started?() click to toggle source
   # File lib/neo4j/core/cypher_session/transactions/driver.rb
38 def started?
39   true
40 end

Private Instance Methods

clean_transaction_registry() click to toggle source
   # File lib/neo4j/core/cypher_session/transactions/driver.rb
48 def clean_transaction_registry
49   Neo4j::Transaction::TransactionsRegistry.transactions_by_session_id[session.object_id] = []
50 end