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 +4 -4
- data/Jarfile +3 -2
- data/lib/pacer-neo4j2.rb +15 -13
- data/lib/pacer-neo4j2/blueprints_graph.rb +30 -1
- data/lib/pacer-neo4j2/lucene_filter.rb +19 -13
- data/lib/pacer-neo4j2/version.rb +1 -1
- data/pacer-neo4j2.gemspec +0 -1
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22883bee14e477a41b513053efb2cbb7790be9e7
|
4
|
+
data.tar.gz: 3ed4d43d44acf83e7d47fe1d504efb309118b8fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fedbb5766bb7650c1e5f2e6723cad33e1e40f420c106b2a5a9a5f77c6334eab9e629059336940fd3f785857bc6715a6dd4959c41d80947042d9031c82d3f7c0
|
7
|
+
data.tar.gz: 0bd752ccec90e8a8510189ce4c3f6c47037ae6e296c99de6407da9fbf686125d56f60d28d12921b2b2682dd6a6491696c30e7498bbdf05b585535539cba2f9a9
|
data/Jarfile
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
|
2
|
-
jar "
|
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'
|
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`
|
46
|
-
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
# together with periodic use of
|
51
|
-
|
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 =
|
59
|
+
graph = graph_class.new(raw_graph)
|
58
60
|
else
|
59
61
|
if args
|
60
|
-
graph =
|
62
|
+
graph = graph_class.new(path, args.to_hash_map)
|
61
63
|
else
|
62
|
-
graph =
|
64
|
+
graph = graph_class.new(path)
|
63
65
|
end
|
64
66
|
graph.allow_auto_tx = false
|
65
|
-
graph.allow_auto_read_tx =
|
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 {
|
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
|
-
|
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
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
-
|
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
|
-
|
112
|
+
graph.read_transaction do
|
113
|
+
"#{ inspect_class_name }(#{ query }) ~ #{ query_result.count }"
|
114
|
+
end
|
109
115
|
end
|
110
116
|
end
|
111
117
|
end
|
data/lib/pacer-neo4j2/version.rb
CHANGED
data/pacer-neo4j2.gemspec
CHANGED
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
|
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:
|
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.
|
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
|