pacer-neo4j2 2.1.7-java → 2.2.1-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 463b795cdce64d8fa56bc6f923d2b263fed3c3a2
4
- data.tar.gz: 04a74ceeedb0e38febf1d318b09f9aa918911565
3
+ metadata.gz: 22883bee14e477a41b513053efb2cbb7790be9e7
4
+ data.tar.gz: 3ed4d43d44acf83e7d47fe1d504efb309118b8fa
5
5
  SHA512:
6
- metadata.gz: 75ee63640fcf0ba0a232891f7b817ab8a1960bbde40a9ce31c065b94c99c5f4040da97fda1d40b4e3a52b8fb456fbcad02c3159d331c168c899b0dea43b925cd
7
- data.tar.gz: 8a25d2b6e989a7d308dc3430f6d44b306bb744ce4cd86eecc4a9f148abb257834f8c07ccb60b3402b46190599cb4875283b6d2e5508a85acf1ca95cf5aedf2b7
6
+ metadata.gz: 6fedbb5766bb7650c1e5f2e6723cad33e1e40f420c106b2a5a9a5f77c6334eab9e629059336940fd3f785857bc6715a6dd4959c41d80947042d9031c82d3f7c0
7
+ data.tar.gz: 0bd752ccec90e8a8510189ce4c3f6c47037ae6e296c99de6407da9fbf686125d56f60d28d12921b2b2682dd6a6491696c30e7498bbdf05b585535539cba2f9a9
data/Jarfile CHANGED
@@ -1,2 +1,3 @@
1
- jar "com.tinkerpop.blueprints:blueprints-neo4j2-graph:2.6.0"
2
- jar "org.neo4j:neo4j:2.1.6"
1
+ repository "https://jcenter.bintray.com"
2
+ jar "com.xnlogic.blueprints:xn-blueprints-neo4j2-graph:2.6.1"
3
+ jar "org.neo4j:neo4j:2.2.1"
data/lib/pacer-neo4j2.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'pacer' unless defined? Pacer
1
+ require 'pacer'
2
2
 
3
3
  lib_path = File.expand_path(File.join(File.dirname(__FILE__), '../lib'))
4
4
  $:.unshift lib_path unless $:.any? { |path| path == lib_path }
@@ -42,27 +42,29 @@ module Pacer
42
42
  # `graph.setCheckElementsInTransaction(false)` to disable the
43
43
  # feature.
44
44
  #
45
- # It is recommended that *in production* the `allow_auto_tx` and
46
- # `allow_auto_read_tx` options be set to `false` to prevent hard-to-debug
47
- # errors caused by Blueprints' automatically starting transactions which it
48
- # never automatically commits or rolls back. When working in the console,
49
- # however, reenabling automatic read transactons is generally recommended,
50
- # together with periodic use of `rollback_implicit_transaction`
51
- def neo4j2(path_or_graph, args = nil)
45
+ # It is recommended that *in production* the `allow_auto_tx` option be set
46
+ # to `false` to prevent hard-to-debug errors caused by Blueprints'
47
+ # automatically starting transactions which it never automatically commits
48
+ # or rolls back. You can also set `allow_auto_read_tx` in the same way.
49
+ # When working in the console, enabling automatic read transactons is
50
+ # generally recommended, together with periodic use of
51
+ # `rollback_implicit_transaction`
52
+ #
53
+ def neo4j2(path_or_graph, args = nil, graph_class = Pacer::Neo4j2::BlueprintsGraph)
52
54
  if path_or_graph.is_a? String
53
55
  path = File.expand_path(path_or_graph)
54
56
  open = proc do
55
57
  raw_graph = Pacer.open_graphs[path]
56
58
  if raw_graph
57
- graph = Pacer::Neo4j2::BlueprintsGraph.new(raw_graph)
59
+ graph = graph_class.new(raw_graph)
58
60
  else
59
61
  if args
60
- graph = Pacer::Neo4j2::BlueprintsGraph.new(path, args.to_hash_map)
62
+ graph = graph_class.new(path, args.to_hash_map)
61
63
  else
62
- graph = Pacer::Neo4j2::BlueprintsGraph.new(path)
64
+ graph = graph_class.new(path)
63
65
  end
64
66
  graph.allow_auto_tx = false
65
- graph.allow_auto_read_tx = false
67
+ graph.allow_auto_read_tx = true
66
68
  Pacer.open_graphs[path] = graph.raw_graph
67
69
  graph.setCheckElementsInTransaction true
68
70
  end
@@ -75,7 +77,7 @@ module Pacer
75
77
  Neo4j2::Graph.new(Pacer::YamlEncoder, open, shutdown)
76
78
  else
77
79
  # Don't register the new graph so that it won't be automatically closed.
78
- Neo4j2::Graph.new Pacer::YamlEncoder, proc { Pacer::Neo4j2::BlueprintsGraph.new(path_or_graph) }
80
+ Neo4j2::Graph.new Pacer::YamlEncoder, proc { graph_class.new(path_or_graph) }
79
81
  end
80
82
  end
81
83
 
@@ -1,6 +1,9 @@
1
1
  module Pacer
2
2
  module Neo4j2
3
- class BlueprintsGraph < com.tinkerpop.blueprints.impls.neo4j2.Neo4j2Graph
3
+ import com.tinkerpop.blueprints.impls.neo4j2.Neo4j2Graph
4
+ import com.tinkerpop.blueprints.impls.neo4j2.Neo4j2HaGraph
5
+
6
+ module TxDepth
4
7
  attr_accessor :allow_auto_tx, :allow_auto_read_tx
5
8
 
6
9
  # Threadlocal tx_depth is set in Pacer's graph_transaction_mixin.rb
@@ -21,6 +24,32 @@ module Pacer
21
24
  depth
22
25
  end
23
26
  end
27
+ end
28
+
29
+
30
+ class BlueprintsGraph < Neo4j2Graph
31
+ include TxDepth
32
+
33
+ def autoStartTransaction(for_write)
34
+ if for_write
35
+ if allow_auto_tx or tx_depth != 0
36
+ super
37
+ else
38
+ raise Pacer::TransactionError, "Can't mutate the graph outside a transaction block"
39
+ end
40
+ else
41
+ if allow_auto_read_tx or read_tx_depth != 0
42
+ super
43
+ else
44
+ raise Pacer::TransactionError, "Can't read the graph outside a transaction or read_transaction block"
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+
51
+ class BlueprintsHaGraph < Neo4j2HaGraph
52
+ include TxDepth
24
53
 
25
54
  def autoStartTransaction(for_write)
26
55
  if for_write
@@ -11,17 +11,19 @@ module Pacer
11
11
  private
12
12
 
13
13
  def choose_index(opts)
14
- et = opts[:element_type]
15
- idx = opts[:index]
16
- case idx
17
- when String, Symbol
18
- index(idx, et).index.raw_index
19
- when Pacer::Wrappers::IndexWrapper
20
- idx.index.raw_index
21
- when com.tinkerpop.blueprints.Index
22
- idx.raw_index
23
- else
24
- lucene_auto_index(et)
14
+ read_transaction do
15
+ et = opts[:element_type]
16
+ idx = opts[:index]
17
+ case idx
18
+ when String, Symbol
19
+ index(idx, et).index.raw_index
20
+ when Pacer::Wrappers::IndexWrapper
21
+ idx.index.raw_index
22
+ when com.tinkerpop.blueprints.Index
23
+ idx.raw_index
24
+ else
25
+ lucene_auto_index(et)
26
+ end
25
27
  end
26
28
  end
27
29
  end
@@ -94,7 +96,9 @@ module Pacer
94
96
  end
95
97
 
96
98
  def query_result
97
- index.query build_query
99
+ graph.read_transaction do
100
+ index.query build_query
101
+ end
98
102
  end
99
103
 
100
104
  def source_iterator
@@ -105,7 +109,9 @@ module Pacer
105
109
  end
106
110
 
107
111
  def inspect_string
108
- "#{ inspect_class_name }(#{ query }) ~ #{ query_result.count }"
112
+ graph.read_transaction do
113
+ "#{ inspect_class_name }(#{ query }) ~ #{ query_result.count }"
114
+ end
109
115
  end
110
116
  end
111
117
  end
@@ -1,6 +1,6 @@
1
1
  module Pacer
2
2
  module Neo4j2
3
- VERSION = "2.1.7"
3
+ VERSION = "2.2.1"
4
4
  PACER_REQ = ">= 2.0.6"
5
5
  end
6
6
  end
data/pacer-neo4j2.gemspec CHANGED
@@ -13,7 +13,6 @@ Gem::Specification.new do |s|
13
13
  s.description = s.summary
14
14
 
15
15
  s.add_dependency 'pacer', Pacer::Neo4j2::PACER_REQ
16
- s.add_dependency "lock_jar", "~> 0.10.2"
17
16
 
18
17
  s.add_development_dependency 'xn_gem_release_tasks'
19
18
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pacer-neo4j2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.7
4
+ version: 2.2.1
5
5
  platform: java
6
6
  authors:
7
7
  - Darrick Wiebe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-28 00:00:00.000000000 Z
11
+ date: 2015-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pacer
@@ -24,20 +24,6 @@ dependencies:
24
24
  version: 2.0.6
25
25
  prerelease: false
26
26
  type: :runtime
27
- - !ruby/object:Gem::Dependency
28
- name: lock_jar
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ~>
32
- - !ruby/object:Gem::Version
33
- version: 0.10.2
34
- requirement: !ruby/object:Gem::Requirement
35
- requirements:
36
- - - ~>
37
- - !ruby/object:Gem::Version
38
- version: 0.10.2
39
- prerelease: false
40
- type: :runtime
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: xn_gem_release_tasks
43
29
  version_requirements: !ruby/object:Gem::Requirement
@@ -102,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
88
  version: '0'
103
89
  requirements: []
104
90
  rubyforge_project: pacer-neo4j2
105
- rubygems_version: 2.1.9
91
+ rubygems_version: 2.4.5
106
92
  signing_key:
107
93
  specification_version: 4
108
94
  summary: Neo4J jars and related code for Pacer