neo4j-ruby-driver 4.4.0.alpha.9 → 4.4.0.beta.1
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 +4 -4
- data/ruby/neo4j/driver/internal/async/network_connection.rb +1 -7
- data/ruby/neo4j/driver/internal/async/pool/channel.rb +1 -3
- data/ruby/neo4j/driver/internal/async/pool/connection_pool_impl.rb +2 -2
- data/ruby/neo4j/driver/internal/async/pool/controller.rb +19 -13
- data/ruby/neo4j/driver/internal/async/pool/timed_stack.rb +15 -0
- data/ruby/neo4j/driver/version.rb +1 -1
- data/ruby/neo4j/driver.rb +1 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c795045f581183398e15ba5c44c1f89b10ea234a9a6dc1e46fecd8c02b857bb3
|
4
|
+
data.tar.gz: 1859daea7265d9409d001e748048ab97837fe26895d80fe4e24773b1b51ed49d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f72367997a92a64e8a75ef08bfca59d0acffaac7589e594b69d8fead9173dc3339d6b3dc26ad63ae1f2f0f7cde0a9f172908e9112b92b3496c209ef8c99e01d
|
7
|
+
data.tar.gz: 7bee1a6da116192d42ad2d9b86091d787211af683278c9cfe136f3c8ebf3d1d8c807834b44d5162a308b47b5208ee8e0b40302961a5dfb83c16a7180353d617e
|
@@ -1,14 +1,13 @@
|
|
1
1
|
module Neo4j::Driver
|
2
2
|
module Internal
|
3
3
|
module Async
|
4
|
-
class NetworkConnection
|
4
|
+
class NetworkConnection
|
5
5
|
include Spi::Connection
|
6
6
|
delegate :protocol, to: :@channel
|
7
7
|
|
8
8
|
attr_reader :server_agent, :server_address, :server_version
|
9
9
|
|
10
10
|
def initialize(channel, channel_pool, logger)
|
11
|
-
super()
|
12
11
|
@log = logger
|
13
12
|
@channel = channel
|
14
13
|
@message_dispatcher = channel.attributes[:message_dispatcher]
|
@@ -23,11 +22,6 @@ module Neo4j::Driver
|
|
23
22
|
@status = Concurrent::AtomicReference.new(Status::OPEN)
|
24
23
|
end
|
25
24
|
|
26
|
-
# def close
|
27
|
-
# super
|
28
|
-
# @io.close
|
29
|
-
# end
|
30
|
-
|
31
25
|
def open?
|
32
26
|
@status.get == Status::OPEN
|
33
27
|
end
|
@@ -2,14 +2,13 @@ module Neo4j::Driver
|
|
2
2
|
module Internal
|
3
3
|
module Async
|
4
4
|
module Pool
|
5
|
-
class Channel
|
5
|
+
class Channel
|
6
6
|
attr :stream
|
7
7
|
attr_accessor :version, :protocol, :message_format, :message_dispatcher
|
8
8
|
attr :attributes # should be attr
|
9
9
|
attr_accessor :auto_read
|
10
10
|
|
11
11
|
def initialize(address, connector, logger)
|
12
|
-
super()
|
13
12
|
@attributes = Connection::ChannelAttributes.new
|
14
13
|
@stream = Connection::Stream.new(connector.connect(address))
|
15
14
|
@stream.write(Connection::BoltProtocolUtil.handshake_buf)
|
@@ -25,7 +24,6 @@ module Neo4j::Driver
|
|
25
24
|
end
|
26
25
|
|
27
26
|
def close
|
28
|
-
super unless closed? # Should this be conditional?
|
29
27
|
@stream.close
|
30
28
|
end
|
31
29
|
|
@@ -77,7 +77,7 @@ module Neo4j::Driver
|
|
77
77
|
private
|
78
78
|
|
79
79
|
def process_acquisition_error(pool, server_address, error)
|
80
|
-
if error.is_a?(::
|
80
|
+
if error.is_a?(ConnectionPool::TimeoutError)
|
81
81
|
# NettyChannelPool returns future failed with TimeoutException if acquire operation takes more than
|
82
82
|
# configured time, translate this exception to a prettier one and re-throw
|
83
83
|
raise Neo4j::Driver::Exceptions::ClientException.new("Unable to acquire connection from the pool within configured maximum time of #{@settings.connection_acquisition_timeout.inspect}")
|
@@ -109,7 +109,7 @@ module Neo4j::Driver
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def new_pool(address)
|
112
|
-
Controller.
|
112
|
+
Controller.new(limit: @settings.max_connection_pool_size, acquisition_timeout: @settings.connection_acquisition_timeout) { Channel.new(address, @connector, @log) }
|
113
113
|
end
|
114
114
|
|
115
115
|
def get_or_create_pool(address)
|
@@ -2,21 +2,27 @@ module Neo4j::Driver
|
|
2
2
|
module Internal
|
3
3
|
module Async
|
4
4
|
module Pool
|
5
|
-
class Controller <
|
6
|
-
def initialize(
|
7
|
-
super(
|
8
|
-
@
|
5
|
+
class Controller < ConnectionPool
|
6
|
+
def initialize(limit: nil, acquisition_timeout: nil, &block)
|
7
|
+
super(size: limit, timeout: acquisition_timeout, &block)
|
8
|
+
@available = TimedStack.new(@size, &block)
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
11
|
+
def acquire(options = {})
|
12
|
+
@available.pop(options[:timeout] || @timeout)
|
13
|
+
end
|
14
|
+
|
15
|
+
def release(resource)
|
16
|
+
@available.push(resource)
|
17
|
+
nil
|
18
|
+
end
|
19
|
+
|
20
|
+
def close
|
21
|
+
@available.shutdown(&:close)
|
22
|
+
end
|
23
|
+
|
24
|
+
def busy?
|
25
|
+
@available.any_resource_busy?
|
20
26
|
end
|
21
27
|
end
|
22
28
|
end
|
data/ruby/neo4j/driver.rb
CHANGED
@@ -5,9 +5,8 @@ require 'active_support/core_ext/hash/keys'
|
|
5
5
|
require 'active_support/logger'
|
6
6
|
require 'async/io'
|
7
7
|
require 'async/io/stream'
|
8
|
-
require 'async/pool'
|
9
|
-
require 'async/pool/resource'
|
10
8
|
require 'async/queue'
|
9
|
+
require 'connection_pool'
|
11
10
|
require 'bigdecimal'
|
12
11
|
require 'date'
|
13
12
|
require 'loader'
|
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.
|
4
|
+
version: 4.4.0.beta.1
|
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-09-
|
11
|
+
date: 2022-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: connection_pool
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -294,6 +294,7 @@ files:
|
|
294
294
|
- ruby/neo4j/driver/internal/async/pool/netty_channel_pool.rb
|
295
295
|
- ruby/neo4j/driver/internal/async/pool/network_connection_factory.rb
|
296
296
|
- ruby/neo4j/driver/internal/async/pool/pool_settings.rb
|
297
|
+
- ruby/neo4j/driver/internal/async/pool/timed_stack.rb
|
297
298
|
- ruby/neo4j/driver/internal/async/result_cursors_holder.rb
|
298
299
|
- ruby/neo4j/driver/internal/async/unmanaged_transaction.rb
|
299
300
|
- ruby/neo4j/driver/internal/bookmark_holder.rb
|