neo4j-ruby-driver 0.3.4 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 285f1e745b1c40e78643541afbda39871b35e261b80f2a11c5a1282339dd9a73
4
- data.tar.gz: 22fde4ee4e1a5ccb729063a1d4bf96ebd51af261c73e9739325fa4817d9109d3
3
+ metadata.gz: c42b006e007156e7b426bd813fc8d13367c1a66931f7047268bf1b667a3a8b72
4
+ data.tar.gz: 7bad351ef37ace5c080db834502ebfc2de2f7a5e6a49171ff99a6069bce0b6f2
5
5
  SHA512:
6
- metadata.gz: 9c044349f323e3aad1215ccbd28b9a4f9f750ae6e0ca0e3ecdaeb4601122fb016169552ab47e4de63b753a0b77eff29c37f4a1b1e56fa9d4486132f9efa599fc
7
- data.tar.gz: dcc9281e5572ca88fb7a8073f1ab7a145209d9a7c055af62c0b985e87e3eeac59a5e5e6fc8beb533c6cf9b1ee217a8538d49460010f0d849d7243588987dc860
6
+ metadata.gz: a3a392ed29054071570b452ff3485a03da001054fc6c8bbc23447ad20d6e408c41632c1b3d257cbf0d92ed3117bebfdb24949767e31f68a4c5bcf3e070daab9b
7
+ data.tar.gz: 76cdc83a140b7d365c45cada9bb23b715ee729b92ffdfa772274f97679450b9f799f15d391e96de5b75ea717575dac48268abb33bf39035f5859ffcc4aa74997
data/README.md CHANGED
@@ -72,12 +72,11 @@ FFI based same as above but with driver variable set:
72
72
  To run the tests the following tools need to be installed:
73
73
 
74
74
  $ brew install python
75
- $ wget https://bootstrap.pypa.io/get-pip.py && python3 get-pip.py --user
76
- $ python3 -m pip install --user git+https://github.com/klobuczek/boltkit@1.3#egg=boltkit
77
- $ neoctrl-install -e 4.0.0 servers
78
- $ neoctrl-configure servers/neo4j-enterprise-4.0.0 dbms.directories.import=
79
- $ neoctrl-set-initial-password password servers/neo4j-enterprise-4.0.0
80
- $ neoctrl-start servers/neo4j-enterprise-4.0.0
75
+ $ pip3 install --user git+https://github.com/klobuczek/boltkit@1.3#egg=boltkit
76
+ $ neoctrl-install -e 4.0.2 servers
77
+ $ neoctrl-configure servers/neo4j-enterprise-4.0.2 dbms.directories.import= dbms.default_listen_address=::
78
+ $ neoctrl-set-initial-password password servers/neo4j-enterprise-4.0.2
79
+ $ neoctrl-start servers/neo4j-enterprise-4.0.2
81
80
 
82
81
  ## Contributing
83
82
 
@@ -54,3 +54,5 @@ module Neo4j
54
54
  end
55
55
 
56
56
  Loader.load
57
+
58
+ Neo4j::Driver::Transaction = Neo4j::Driver::Internal::ExplicitTransaction
@@ -30,6 +30,7 @@ module Neo4j
30
30
  )
31
31
  end
32
32
  set_bookmarks(:set_run_bookmarks, boomarks_holder.bookmarks)
33
+ set_config(:set_run, config)
33
34
  register(run_handler, Bolt::Connection.load_run_request(bolt_connection))
34
35
  register(pull_handler, Bolt::Connection.load_pull_request(bolt_connection, -1))
35
36
  flush
@@ -42,6 +43,7 @@ module Neo4j
42
43
  def begin(bookmarks, config, begin_handler)
43
44
  check_error Bolt::Connection.clear_begin(bolt_connection)
44
45
  set_bookmarks(:set_begin_bookmarks, bookmarks)
46
+ set_config(:set_begin, config)
45
47
  register(begin_handler, Bolt::Connection.load_begin_request(bolt_connection))
46
48
  end
47
49
 
@@ -82,6 +84,21 @@ module Neo4j
82
84
  Value::ValueAdapter.to_neo(value, bookmarks)
83
85
  check_error Bolt::Connection.send(method, bolt_connection, value)
84
86
  end
87
+
88
+ def set_config(method_prefix, config)
89
+ return unless config
90
+ config.each do |key, value|
91
+ case key
92
+ when :timeout
93
+ check_error Bolt::Connection.send("#{method_prefix}_tx_timeout", bolt_connection,
94
+ DurationNormalizer.milliseconds(value))
95
+ when :metadata
96
+ bolt_value = Bolt::Value.create
97
+ Value::ValueAdapter.to_neo(bolt_value, value)
98
+ check_error Bolt::Connection.send("#{method_prefix}_tx_metadata", bolt_connection, bolt_value)
99
+ end
100
+ end
101
+ end
85
102
  end
86
103
  end
87
104
  end
@@ -4,7 +4,7 @@ module Neo4j
4
4
  module Driver
5
5
  module Internal
6
6
  class InternalRecord
7
- attr_reader :values
7
+ attr_reader :keys, :values
8
8
  delegate :first, to: :values
9
9
 
10
10
  def initialize(keys, values)
@@ -18,7 +18,7 @@ module Neo4j
18
18
  @retry_logic = retry_logic
19
19
  end
20
20
 
21
- def run(statement, parameters = {}, config = nil)
21
+ def run(statement, parameters = {}, config = {})
22
22
  ensure_session_is_open
23
23
  ensure_no_open_tx_before_running_query
24
24
  acquire_connection(@mode)
@@ -27,11 +27,11 @@ module Neo4j
27
27
  )
28
28
  end
29
29
 
30
- def read_transaction(config = nil, &block)
30
+ def read_transaction(**config, &block)
31
31
  transaction(Neo4j::Driver::AccessMode::READ, config, &block)
32
32
  end
33
33
 
34
- def write_transaction(config = nil, &block)
34
+ def write_transaction(**config, &block)
35
35
  transaction(Neo4j::Driver::AccessMode::WRITE, config, &block)
36
36
  end
37
37
 
@@ -49,11 +49,8 @@ module Neo4j
49
49
  @connection&.release
50
50
  end
51
51
 
52
- def begin_transaction(mode = @mode, config = nil)
53
- ensure_session_is_open
54
- ensure_no_open_tx_before_starting_tx
55
- acquire_connection(mode)
56
- @transaction = ExplicitTransaction.new(@connection, self).begin(bookmarks, config)
52
+ def begin_transaction(**config)
53
+ private_begin_transaction(@mode, config)
57
54
  end
58
55
 
59
56
  def last_bookmark
@@ -66,9 +63,16 @@ module Neo4j
66
63
 
67
64
  private
68
65
 
69
- def transaction(mode, config = nil)
66
+ def private_begin_transaction(mode, config)
67
+ ensure_session_is_open
68
+ ensure_no_open_tx_before_starting_tx
69
+ acquire_connection(mode)
70
+ @transaction = ExplicitTransaction.new(@connection, self).begin(bookmarks, config)
71
+ end
72
+
73
+ def transaction(mode, config)
70
74
  @retry_logic.retry do
71
- tx = begin_transaction(mode, config)
75
+ tx = private_begin_transaction(mode, config)
72
76
  result = yield tx
73
77
  tx.success
74
78
  result
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Neo4j
4
4
  module Driver
5
- VERSION = '0.3.4'
5
+ VERSION = '0.3.5'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j-ruby-driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Heinrich Klobuczek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-12 00:00:00.000000000 Z
11
+ date: 2020-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport