Class: Pacer::Neo4j::BlueprintsGraph

Inherits:
Object
  • Object
show all
Defined in:
lib/pacer-neo4j/blueprints_graph.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#allow_auto_txObject

Returns the value of attribute allow_auto_tx.



4
5
6
# File 'lib/pacer-neo4j/blueprints_graph.rb', line 4

def allow_auto_tx
  @allow_auto_tx
end

Instance Method Details

#autoStartTransactionObject



13
14
15
16
17
18
19
# File 'lib/pacer-neo4j/blueprints_graph.rb', line 13

def autoStartTransaction
  if allow_auto_tx or tx_depth != 0
    super
  else
    raise Pacer::TransactionError, "Can't mutate the graph outside a transaction block"
  end
end

#tx_depthObject

Threadlocal tx_depth is set in Pacer’s graph_transaction_mixin.rb



7
8
9
10
11
# File 'lib/pacer-neo4j/blueprints_graph.rb', line 7

def tx_depth
  graphs = Thread.current[:graphs] ||= {}
  tgi = graphs[object_id] ||= {}
  tgi[:tx_depth] || 0
end