neo4j-ruby-driver 4.4.0.alpha.3 → 4.4.0.alpha.6

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
  SHA256:
3
- metadata.gz: 215ccaf987bd078ea71788fa8192fbab18583b993d75a94f9bf67ce68dd36505
4
- data.tar.gz: 06641d8ce0a339e3476c76a6bc26bb5a5c11f23a99706b566ea6af5ca2e347d1
3
+ metadata.gz: e1dc1f5cbdb0085a5e75fd3809b9e830c5c60e93f688e42c939c2fbe7015bde7
4
+ data.tar.gz: 81786afebfdb15a41550bf5997aef82adcb26ea8f5551a1e48e8c7571211e994
5
5
  SHA512:
6
- metadata.gz: ada6594b73ebd31344252242a23e3759d5b2642b38dd94e1707d13473d29b8d3aea8d6b969a38d990f1d7b9f0c51b0cd9f01be35bbaf464cee89de49f0ea08e5
7
- data.tar.gz: b8fe88bb2f7b9e251905b3d72b5afd3e2f73c764e58e72f46697b3d758d93a09c43e6766380102dbcc4550c4667a777e0e79064a6e16b61260a1e1a821ccbda8
6
+ metadata.gz: 0ba9e1ff39437d069150c3d7706a93c7b21054d2fb5e03ecc1bdc2cd864145bd2609cfca46448b0a84354f78ab983164b25bdcc12e8fb8b6061eea498c4651c3
7
+ data.tar.gz: 3549a85e58efeb737c6d48cde04ce8da6bd2e2d07d2b927ff8669a4a9fca390f621e60e7e6670d286b66cb242aff625b1112760e8470632a8f6a89464bae4c20
data/README.md CHANGED
@@ -42,6 +42,7 @@ This gem includes 2 different implementations: java driver wrapper and pure ruby
42
42
  ## Testing
43
43
 
44
44
  To run the tests the following tools need to be installed:
45
+
45
46
  $ brew install python
46
47
  $ pip3 install --user git+https://github.com/klobuczek/boltkit@1.3#egg=boltkit
47
48
  $ neoctrl-install -e 4.4.5 servers
@@ -79,7 +79,7 @@ module Neo4j
79
79
 
80
80
  def init_security_and_trust_config
81
81
  relevant = %i[encryption trust_strategy]
82
- customized = slice(*relevant) == DEFAULTS.slice(*relevant)
82
+ customized = slice(*relevant) != DEFAULTS.slice(*relevant)
83
83
  merge!(security_settings: Neo4j::Driver::Internal::SecuritySetting.new(
84
84
  fetch(:encryption), TrustStrategy.new(**fetch(:trust_strategy)), customized),
85
85
  )
@@ -151,7 +151,7 @@ module Neo4j::Driver
151
151
  @auto_read_managing_handler.disable_auto_read_management
152
152
 
153
153
  # restore the default value of auto-read
154
- @channel.config.set_auto_read(true)
154
+ @channel.auto_read = true
155
155
  end
156
156
 
157
157
  @auto_read_managing_handler = new_handler
@@ -33,11 +33,11 @@ module Neo4j::Driver
33
33
  end
34
34
 
35
35
  def enable_auto_read
36
- set_auto_read(true) if open?
36
+ @channel.auto_read = true if open?
37
37
  end
38
38
 
39
39
  def disable_auto_read
40
- set_auto_read(false) if open?
40
+ @channel.auto_read = false if open?
41
41
  end
42
42
 
43
43
  def flush
@@ -69,13 +69,12 @@ module Neo4j::Driver
69
69
 
70
70
  def release
71
71
  if @status.compare_and_set(Status::OPEN, Status::RELEASED)
72
- @channel_pool.release(@channel)
72
+ handler = Handlers::ChannelReleasingResetResponseHandler.new(@channel, @channel_pool, @message_dispatcher, @log, @release)
73
+ write_reset_message_if_needed(handler, false)
74
+ # @metrics_listener.after_connection_released(Connection::ChannelAttributes.pool_id(@channel), @in_use_event)
75
+ # end
76
+ # @release_future
73
77
  end
74
- # handler = Handlers::ChannelReleasingResetResponseHandler.new(@channel, @channel_pool, @message_dispatcher, @clock, @release)
75
- # write_reset_message_if_needed(handler, false)
76
- # @metrics_listener.after_connection_released(Connection::ChannelAttributes.pool_id(@channel), @in_use_event)
77
- # end
78
- # @release_future
79
78
  end
80
79
 
81
80
  def terminate_and_release(reason)
@@ -91,15 +90,13 @@ module Neo4j::Driver
91
90
  private
92
91
 
93
92
  def write_reset_message_if_needed(reset_handler, is_session_reset)
94
- @channel.event_loop.execute do
95
- if is_session_reset && !open?
96
- reset_handler.on_success(java.util.Collections.empty_map)
97
- else
98
- # auto-read could've been disabled, re-enable it to automatically receive response for RESET
99
- set_auto_read(true)
100
- @message_dispatcher.enqueue(reset_handler)
101
- @channel.write_and_flush(Messaging::Request::ResetMessage::RESET).add_listener(-> (_future) { register_connection_read_timeout(@channel) })
102
- end
93
+ if is_session_reset && !open?
94
+ reset_handler.on_success
95
+ else
96
+ # auto-read could've been disabled, re-enable it to automatically receive response for RESET
97
+ @channel.auto_read = true
98
+ @message_dispatcher.enqueue(reset_handler)
99
+ @channel.write_and_flush(Messaging::Request::ResetMessage::RESET)#.add_listener(-> (_future) { register_connection_read_timeout(@channel) })
103
100
  end
104
101
  end
105
102
 
@@ -114,7 +111,7 @@ module Neo4j::Driver
114
111
  @message_dispatcher.enqueue(handler)
115
112
 
116
113
  if flush
117
- @channel.write_and_flush(message)#.add_listener(-> (_future) { register_connection_read_timeout(@channel) })
114
+ @channel.write_and_flush(message) #.add_listener(-> (_future) { register_connection_read_timeout(@channel) })
118
115
  else
119
116
  @channel.write(message)
120
117
  end
@@ -135,10 +132,6 @@ module Neo4j::Driver
135
132
  end
136
133
  end
137
134
 
138
- def set_auto_read(value)
139
- @channel.config.set_auto_read(value)
140
- end
141
-
142
135
  def verify_open(handler1, handler2)
143
136
  connection_status = @status.get
144
137
 
@@ -6,6 +6,7 @@ module Neo4j::Driver
6
6
  attr :stream
7
7
  attr_accessor :version, :protocol, :message_format, :message_dispatcher
8
8
  attr :attributes # should be attr
9
+ attr_accessor :auto_read
9
10
 
10
11
  def initialize(address, connector, logger)
11
12
  super()
@@ -20,6 +20,7 @@ module Neo4j::Driver
20
20
 
21
21
  begin
22
22
  channel = pool.acquire
23
+ @log.debug{"Channel #{channel.object_id} acquired"}
23
24
  rescue => error
24
25
  process_acquisition_error(pool, address, error)
25
26
  end
@@ -2,26 +2,27 @@ module Neo4j::Driver
2
2
  module Internal
3
3
  module Handlers
4
4
  class ChannelReleasingResetResponseHandler < ResetResponseHandler
5
- def initialize(channel, pool, message_dispatcher, clock, release_future)
5
+ def initialize(channel, pool, message_dispatcher, log, release_future)
6
6
  super(message_dispatcher, release_future)
7
7
  @channel = channel
8
8
  @pool = pool
9
- @clock = clock
9
+ @log = log
10
10
  end
11
11
 
12
- def reset_completed(completion_future, success)
12
+ def reset_completed(success)
13
13
  if success
14
14
  # update the last-used timestamp before returning the channel back to the pool
15
- Async::Connection::ChannelAttributes.set_last_used_timestamp(@channel, @clock.millis)
16
- closure_stage = Util::Futures.completed_with_null
15
+ # Async::Connection::ChannelAttributes.set_last_used_timestamp(@channel, @clock.millis)
16
+ # closure_stage = Util::Futures.completed_with_null
17
17
  else
18
18
  # close the channel before returning it back to the pool if RESET failed
19
- closure_stage = Util::Futures.as_completion_stage(@channel.close)
20
- end
21
-
22
- closure_stage.exceptionally(-> (_throwable) { nil }).then_compose(-> (_ignored) { @pool.release(@channel) }).when_complete do |_, _error|
23
- completion_future.complete(nil)
19
+ @channel.close
24
20
  end
21
+ rescue
22
+ nil
23
+ ensure
24
+ @pool.release(@channel)
25
+ @log.debug { "Channel #{@channel.object_id} released." }
25
26
  end
26
27
  end
27
28
  end
@@ -212,7 +212,7 @@ module Neo4j::Driver
212
212
 
213
213
  def extract_result_summary(metadata)
214
214
  result_available_after = @run_response_handler.result_available_after
215
- @metadataExtractor.extract_summary(@query, @connection, result_available_after, metadata)
215
+ @metadata_extractor.extract_summary(@query, @connection, result_available_after, metadata)
216
216
  end
217
217
 
218
218
  def enable_auto_read
@@ -4,7 +4,6 @@ module Neo4j::Driver
4
4
  module Pulln
5
5
  class AutoPullResponseHandler < BasicPullResponseHandler
6
6
  delegate :signal, to: :@records
7
- UNINITIALIZED_RECORDS = ::Async::Queue.new
8
7
  LONG_MAX_VALUE = 2 ** 63 - 1
9
8
 
10
9
  def initialize(query, run_response_handler, connection, metadata_extractor, completion_listener, fetch_size)
@@ -20,7 +19,7 @@ module Neo4j::Driver
20
19
  @low_record_watermark = fetch_size * 0.3
21
20
  end
22
21
 
23
- @records = UNINITIALIZED_RECORDS
22
+ @records = ::Async::Queue.new
24
23
  @auto_pull_enabled = true
25
24
 
26
25
  install_record_and_summary_consumers
@@ -9,7 +9,7 @@ module Neo4j::Driver
9
9
  @completion_future = completion_future
10
10
  end
11
11
 
12
- def on_success(_metadata)
12
+ def on_success(_metadata = {})
13
13
  reset_completed(true)
14
14
  end
15
15
 
@@ -10,14 +10,12 @@ module Neo4j::Driver
10
10
  @values = values.to_set
11
11
  end
12
12
 
13
- def eql?(other)
14
- values.eql?(other.values)
15
- end
16
-
17
13
  def ==(other)
18
- values == other.values
14
+ equal?(other) || self.class == other.class && values == other.values
19
15
  end
20
16
 
17
+ alias eql? ==
18
+
21
19
  def to_s
22
20
  "Bookmark{values=#{values}}"
23
21
  end
@@ -7,7 +7,7 @@ module Neo4j::Driver
7
7
  # delegate :verify_connectivity, to: :session_factory
8
8
  delegate :metrics, :metrics_enabled?, to: :metrics_provider
9
9
  auto_closable :session
10
- sync :close, :supports_multi_db?, :verify_connectivity
10
+ sync :close, :supports_multi_db?, :verify_connectivity, :session
11
11
 
12
12
  def initialize(security_plan, session_factory, metrics_provider, logger)
13
13
  @closed = Concurrent::AtomicBoolean.new(false)
@@ -10,13 +10,11 @@ module Neo4j::Driver
10
10
  @properties = properties
11
11
  end
12
12
 
13
- def eql?(other)
14
- id.eql?(other.id)
15
- end
16
-
17
13
  def ==(other)
18
- id == other.id
14
+ equal?(other) || self.class == other.class && id == other.id
19
15
  end
16
+
17
+ alias eql? ==
20
18
  end
21
19
  end
22
20
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Neo4j
4
4
  module Driver
5
- VERSION = '4.4.0.alpha.3'
5
+ VERSION = '4.4.0.alpha.6'
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: 4.4.0.alpha.3
4
+ version: 4.4.0.alpha.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Heinrich Klobuczek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-21 00:00:00.000000000 Z
11
+ date: 2022-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: async
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: zeitwerk
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -81,7 +67,7 @@ dependencies:
81
67
  - !ruby/object:Gem::Version
82
68
  version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
- name: ffaker
70
+ name: async
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
73
  - - ">="
@@ -95,7 +81,7 @@ dependencies:
95
81
  - !ruby/object:Gem::Version
96
82
  version: '0'
97
83
  - !ruby/object:Gem::Dependency
98
- name: hoe
84
+ name: ffaker
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
87
  - - ">="
@@ -109,7 +95,7 @@ dependencies:
109
95
  - !ruby/object:Gem::Version
110
96
  version: '0'
111
97
  - !ruby/object:Gem::Dependency
112
- name: hoe-bundler
98
+ name: hoe
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
101
  - - ">="
@@ -123,7 +109,7 @@ dependencies:
123
109
  - !ruby/object:Gem::Version
124
110
  version: '0'
125
111
  - !ruby/object:Gem::Dependency
126
- name: hoe-gemspec
112
+ name: hoe-bundler
127
113
  requirement: !ruby/object:Gem::Requirement
128
114
  requirements:
129
115
  - - ">="
@@ -137,7 +123,7 @@ dependencies:
137
123
  - !ruby/object:Gem::Version
138
124
  version: '0'
139
125
  - !ruby/object:Gem::Dependency
140
- name: parallel
126
+ name: hoe-gemspec
141
127
  requirement: !ruby/object:Gem::Requirement
142
128
  requirements:
143
129
  - - ">="