neo4j-core 3.0.0.alpha.18 → 3.0.0.alpha.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/README.md +2 -1
- data/lib/neo4j-core/query.rb +1 -1
- data/lib/neo4j-core/version.rb +1 -1
- data/lib/neo4j-core/version.rb~ +5 -0
- data/lib/neo4j-embedded.rb +1 -0
- data/lib/neo4j-embedded/cypher_response.rb~ +85 -0
- data/lib/neo4j-embedded/embedded_node.rb~ +201 -0
- data/lib/neo4j-embedded/embedded_relationship.rb +4 -0
- data/lib/neo4j-embedded/embedded_relationship.rb~ +62 -0
- data/lib/neo4j-embedded/embedded_session.rb +14 -0
- data/lib/neo4j-embedded/embedded_session.rb~ +145 -0
- data/lib/neo4j-embedded/embedded_transaction.rb +35 -0
- data/lib/neo4j-embedded/property.rb +6 -2
- data/lib/neo4j-server/cypher_node.rb +20 -7
- data/lib/neo4j-server/cypher_relationship.rb +16 -4
- data/lib/neo4j-server/cypher_response.rb +43 -17
- data/lib/neo4j-server/cypher_response.rb~ +155 -0
- data/lib/neo4j-server/cypher_session.rb +26 -3
- data/lib/neo4j-server/cypher_transaction.rb +14 -21
- data/lib/neo4j/node.rb +5 -7
- data/lib/neo4j/relationship.rb +5 -0
- data/lib/neo4j/session.rb +16 -0
- data/lib/neo4j/session.rb~ +202 -0
- data/lib/neo4j/transaction.rb +100 -33
- metadata +53 -31
data/lib/neo4j/transaction.rb
CHANGED
@@ -1,51 +1,118 @@
|
|
1
1
|
module Neo4j
|
2
|
-
|
3
|
-
def self.new(current = Session.current)
|
4
|
-
current.begin_tx
|
5
|
-
end
|
2
|
+
module Transaction
|
6
3
|
|
4
|
+
extend self
|
7
5
|
|
8
|
-
|
6
|
+
module Instance
|
7
|
+
# @private
|
8
|
+
def register_instance
|
9
|
+
@pushed_nested = 0
|
10
|
+
Neo4j::Transaction.register(self)
|
11
|
+
end
|
9
12
|
|
10
|
-
|
11
|
-
|
13
|
+
# Marks this transaction as failed, which means that it will unconditionally be rolled back when close() is called.
|
14
|
+
def failure
|
15
|
+
@failure = true
|
16
|
+
end
|
17
|
+
alias_method :fail, :failure
|
12
18
|
|
13
|
-
|
19
|
+
# If it has been marked as failed
|
20
|
+
def failure?
|
21
|
+
!!@failure
|
22
|
+
end
|
14
23
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
tx.success
|
19
|
-
rescue Exception => e
|
20
|
-
if e.respond_to?(:cause) && e.cause
|
21
|
-
puts "Java Exception in a transaction, cause: #{e.cause}"
|
22
|
-
e.cause.print_stack_trace
|
23
|
-
end
|
24
|
-
tx.failure unless tx.nil?
|
25
|
-
raise
|
26
|
-
ensure
|
27
|
-
tx.finish unless tx.nil?
|
28
|
-
end
|
29
|
-
ret
|
24
|
+
# @private
|
25
|
+
def push_nested!
|
26
|
+
@pushed_nested += 1
|
30
27
|
end
|
31
28
|
|
32
|
-
|
33
|
-
|
29
|
+
# @private
|
30
|
+
def pop_nested!
|
31
|
+
@pushed_nested -= 1
|
34
32
|
end
|
35
33
|
|
36
|
-
|
37
|
-
|
34
|
+
# Only for the embedded neo4j !
|
35
|
+
# Acquires a read lock for entity for this transaction.
|
36
|
+
# See neo4j java docs.
|
37
|
+
# @param [Neo4j::Node,Neo4j::Relationship] entity
|
38
|
+
# @return [Java::OrgNeo4jKernelImplCoreapi::PropertyContainerLocker]
|
39
|
+
def acquire_read_lock(entity)
|
38
40
|
end
|
39
41
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
42
|
+
# Only for the embedded neo4j !
|
43
|
+
# Acquires a write lock for entity for this transaction.
|
44
|
+
# See neo4j java docs.
|
45
|
+
# @param [Neo4j::Node,Neo4j::Relationship] entity
|
46
|
+
# @return [Java::OrgNeo4jKernelImplCoreapi::PropertyContainerLocker]
|
47
|
+
def acquire_write_lock(entity)
|
44
48
|
end
|
45
49
|
|
46
|
-
|
47
|
-
|
50
|
+
# Commits or marks this transaction for rollback, depending on whether failure() has been previously invoked.
|
51
|
+
def close
|
52
|
+
pop_nested!
|
53
|
+
return if @pushed_nested >= 0
|
54
|
+
raise "Can't commit transaction, already committed" if (@pushed_nested < -1)
|
55
|
+
Neo4j::Transaction.unregister(self)
|
56
|
+
if failure?
|
57
|
+
_delete_tx
|
58
|
+
else
|
59
|
+
_commit_tx
|
60
|
+
end
|
48
61
|
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
# @return [Neo4j::Transaction::Instance]
|
68
|
+
def new(current = Session.current!)
|
69
|
+
current.begin_tx
|
70
|
+
end
|
71
|
+
|
72
|
+
# Runs the given block in a new transaction.
|
73
|
+
# @param [Boolean] run_in_tx if true a new transaction will not be created, instead if will simply yield to the given block
|
74
|
+
# @@yield [Neo4j::Transaction::Instance]
|
75
|
+
def run(run_in_tx=true)
|
76
|
+
raise ArgumentError.new("Expected a block to run in Transaction.run") unless block_given?
|
77
|
+
|
78
|
+
return yield(nil) unless run_in_tx
|
79
|
+
|
80
|
+
begin
|
81
|
+
tx = Neo4j::Transaction.new
|
82
|
+
ret = yield tx
|
83
|
+
rescue Exception => e
|
84
|
+
if e.respond_to?(:cause) && e.cause
|
85
|
+
puts "Java Exception in a transaction, cause: #{e.cause}"
|
86
|
+
e.cause.print_stack_trace
|
87
|
+
end
|
88
|
+
tx.failure unless tx.nil?
|
89
|
+
raise
|
90
|
+
ensure
|
91
|
+
tx.close unless tx.nil?
|
92
|
+
end
|
93
|
+
ret
|
94
|
+
end
|
95
|
+
|
96
|
+
# @return [Neo4j::Transaction]
|
97
|
+
def current
|
98
|
+
Thread.current[:neo4j_curr_tx]
|
99
|
+
end
|
100
|
+
|
101
|
+
# @private
|
102
|
+
def unregister(tx)
|
103
|
+
Thread.current[:neo4j_curr_tx] = nil if tx == Thread.current[:neo4j_curr_tx]
|
104
|
+
end
|
105
|
+
|
106
|
+
# @private
|
107
|
+
def register(tx)
|
108
|
+
# we don't support running more then one transaction per thread
|
109
|
+
raise "Already running a transaction" if current
|
110
|
+
Thread.current[:neo4j_curr_tx] = tx
|
111
|
+
end
|
112
|
+
|
113
|
+
# @private
|
114
|
+
def unregister_current
|
115
|
+
Thread.current[:neo4j_curr_tx] = nil
|
49
116
|
end
|
50
117
|
|
51
118
|
end
|
metadata
CHANGED
@@ -1,71 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neo4j-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.alpha.
|
4
|
+
version: 3.0.0.alpha.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Ronge
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
15
20
|
requirement: !ruby/object:Gem::Requirement
|
16
21
|
requirements:
|
17
|
-
- -
|
22
|
+
- - '>='
|
18
23
|
- !ruby/object:Gem::Version
|
19
24
|
version: '0'
|
20
|
-
type: :runtime
|
21
25
|
prerelease: false
|
26
|
+
type: :runtime
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
22
29
|
version_requirements: !ruby/object:Gem::Requirement
|
23
30
|
requirements:
|
24
|
-
- -
|
31
|
+
- - '>='
|
25
32
|
- !ruby/object:Gem::Version
|
26
33
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: json
|
29
34
|
requirement: !ruby/object:Gem::Requirement
|
30
35
|
requirements:
|
31
|
-
- -
|
36
|
+
- - '>='
|
32
37
|
- !ruby/object:Gem::Version
|
33
38
|
version: '0'
|
34
|
-
type: :runtime
|
35
39
|
prerelease: false
|
40
|
+
type: :runtime
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: os
|
36
43
|
version_requirements: !ruby/object:Gem::Requirement
|
37
44
|
requirements:
|
38
|
-
- -
|
45
|
+
- - '>='
|
39
46
|
- !ruby/object:Gem::Version
|
40
47
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: os
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
44
49
|
requirements:
|
45
|
-
- -
|
50
|
+
- - '>='
|
46
51
|
- !ruby/object:Gem::Version
|
47
52
|
version: '0'
|
48
|
-
type: :runtime
|
49
53
|
prerelease: false
|
54
|
+
type: :runtime
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: zip
|
50
57
|
version_requirements: !ruby/object:Gem::Requirement
|
51
58
|
requirements:
|
52
|
-
- -
|
59
|
+
- - '>='
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: zip
|
57
62
|
requirement: !ruby/object:Gem::Requirement
|
58
63
|
requirements:
|
59
|
-
- -
|
64
|
+
- - '>='
|
60
65
|
- !ruby/object:Gem::Version
|
61
66
|
version: '0'
|
62
|
-
type: :runtime
|
63
67
|
prerelease: false
|
68
|
+
type: :runtime
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: neo4j-community
|
64
71
|
version_requirements: !ruby/object:Gem::Requirement
|
65
72
|
requirements:
|
66
|
-
- -
|
73
|
+
- - ~>
|
67
74
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
75
|
+
version: 2.1.1
|
76
|
+
requirement: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ~>
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 2.1.1
|
81
|
+
prerelease: false
|
82
|
+
type: :runtime
|
69
83
|
description: |
|
70
84
|
You can think of Neo4j as a high-performance graph engine with all the features of a mature and robust database.
|
71
85
|
The programmer works with an object-oriented, flexible network structure rather than with strict and static tables
|
@@ -87,14 +101,20 @@ files:
|
|
87
101
|
- lib/neo4j-core/query.rb
|
88
102
|
- lib/neo4j-core/query_clauses.rb
|
89
103
|
- lib/neo4j-core/version.rb
|
104
|
+
- lib/neo4j-core/version.rb~
|
90
105
|
- lib/neo4j-embedded.rb
|
91
106
|
- lib/neo4j-embedded/cypher_response.rb
|
107
|
+
- lib/neo4j-embedded/cypher_response.rb~
|
92
108
|
- lib/neo4j-embedded/embedded_database.rb
|
93
109
|
- lib/neo4j-embedded/embedded_impermanent_session.rb
|
94
110
|
- lib/neo4j-embedded/embedded_label.rb
|
95
111
|
- lib/neo4j-embedded/embedded_node.rb
|
112
|
+
- lib/neo4j-embedded/embedded_node.rb~
|
96
113
|
- lib/neo4j-embedded/embedded_relationship.rb
|
114
|
+
- lib/neo4j-embedded/embedded_relationship.rb~
|
97
115
|
- lib/neo4j-embedded/embedded_session.rb
|
116
|
+
- lib/neo4j-embedded/embedded_session.rb~
|
117
|
+
- lib/neo4j-embedded/embedded_transaction.rb
|
98
118
|
- lib/neo4j-embedded/property.rb
|
99
119
|
- lib/neo4j-embedded/to_java.rb
|
100
120
|
- lib/neo4j-server.rb
|
@@ -103,6 +123,7 @@ files:
|
|
103
123
|
- lib/neo4j-server/cypher_node_uncommited.rb
|
104
124
|
- lib/neo4j-server/cypher_relationship.rb
|
105
125
|
- lib/neo4j-server/cypher_response.rb
|
126
|
+
- lib/neo4j-server/cypher_response.rb~
|
106
127
|
- lib/neo4j-server/cypher_session.rb
|
107
128
|
- lib/neo4j-server/cypher_transaction.rb
|
108
129
|
- lib/neo4j-server/neo4j_server_endpoint.rb
|
@@ -114,6 +135,7 @@ files:
|
|
114
135
|
- lib/neo4j/property_validator.rb
|
115
136
|
- lib/neo4j/relationship.rb
|
116
137
|
- lib/neo4j/session.rb
|
138
|
+
- lib/neo4j/session.rb~
|
117
139
|
- lib/neo4j/tasks/neo4j_server.rb
|
118
140
|
- lib/neo4j/transaction.rb
|
119
141
|
- neo4j-core.gemspec
|
@@ -121,31 +143,31 @@ homepage: http://github.com/andreasronge/neo4j-core/tree
|
|
121
143
|
licenses:
|
122
144
|
- MIT
|
123
145
|
metadata: {}
|
124
|
-
post_install_message:
|
146
|
+
post_install_message:
|
125
147
|
rdoc_options:
|
126
|
-
-
|
127
|
-
-
|
148
|
+
- --quiet
|
149
|
+
- --title
|
128
150
|
- Neo4j::Core
|
129
|
-
-
|
130
|
-
-
|
151
|
+
- --line-numbers
|
152
|
+
- --main
|
131
153
|
- README.rdoc
|
132
|
-
-
|
154
|
+
- --inline-source
|
133
155
|
require_paths:
|
134
156
|
- lib
|
135
157
|
required_ruby_version: !ruby/object:Gem::Requirement
|
136
158
|
requirements:
|
137
|
-
- -
|
159
|
+
- - '>='
|
138
160
|
- !ruby/object:Gem::Version
|
139
161
|
version: 1.8.7
|
140
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
163
|
requirements:
|
142
|
-
- -
|
164
|
+
- - '>'
|
143
165
|
- !ruby/object:Gem::Version
|
144
166
|
version: 1.3.1
|
145
167
|
requirements: []
|
146
168
|
rubyforge_project: neo4j-core
|
147
169
|
rubygems_version: 2.2.2
|
148
|
-
signing_key:
|
170
|
+
signing_key:
|
149
171
|
specification_version: 4
|
150
172
|
summary: A graph database for Ruby
|
151
173
|
test_files: []
|