neo4j-ruby-driver 4.4.0.alpha.4 → 4.4.0.alpha.5

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: dceecd30fd6fa4473c3ec6bb640b6126bd7bb06eb5057d58e46064d8c434a929
4
- data.tar.gz: 0e1a77da3ca678a1b4a201fa0d0211a771a009a77bb81b1a0c98e331b22c5471
3
+ metadata.gz: 92d999b42ad79f180328388f8b50e610e35190b2efc0b5ad9f799773a3d5d006
4
+ data.tar.gz: 759f1058c5dcf0c12d970dec2793bd2f6a5600aecfcdeb43f63b19630f038fb2
5
5
  SHA512:
6
- metadata.gz: fdd3c4bbdd314fb7036ce6c7fedba8a49e26b194450dea535a7aa05f380d58a6ab04ea7edbba6cf664514c1585084ad0e17c40fb719a9794f127ee3623c169db
7
- data.tar.gz: 673a7aa8a4f3192f7b9b15b91efaca7c05dfcb79779b39ed4f014989db06672f7c293fd3948e16fc515177cae84e428f5885b3f1d3b4c081f05e580afbd66b5d
6
+ metadata.gz: 50d2744664faa1596e8fe964db0b083e216f58b001a4d3d7d70218752814a164d4e83ea71f5d4b4b2330432aa58d74b12875ea182bb8f99aad701a831032cc73
7
+ data.tar.gz: 5d8f9e3e8eb358d7aa494d7be74d3ee49507ff2496f346d0b5ab9defea5c92a6017e147ae51b0e128728a667ef924cdf8b7e13f69ff398a1f6f6606d24cddeef
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
@@ -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
 
@@ -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)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Neo4j
4
4
  module Driver
5
- VERSION = '4.4.0.alpha.4'
5
+ VERSION = '4.4.0.alpha.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: 4.4.0.alpha.4
4
+ version: 4.4.0.alpha.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: 2022-06-21 00:00:00.000000000 Z
11
+ date: 2022-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -136,20 +136,6 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: parallel
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
139
  - !ruby/object:Gem::Dependency
154
140
  name: rake
155
141
  requirement: !ruby/object:Gem::Requirement