neospace 0.0.1 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +21 -0
- data/README.md +88 -0
- data/ffi/bolt/address.rb +11 -0
- data/ffi/bolt/address_resolver.rb +12 -0
- data/ffi/bolt/address_set.rb +9 -0
- data/ffi/bolt/auth.rb +10 -0
- data/ffi/bolt/auto_releasable.rb +22 -0
- data/ffi/bolt/boolean.rb +9 -0
- data/ffi/bolt/bytes.rb +10 -0
- data/ffi/bolt/config.rb +45 -0
- data/ffi/bolt/connection.rb +44 -0
- data/ffi/bolt/connector.rb +17 -0
- data/ffi/bolt/dictionary.rb +15 -0
- data/ffi/bolt/error.rb +74 -0
- data/ffi/bolt/float.rb +9 -0
- data/ffi/bolt/integer.rb +9 -0
- data/ffi/bolt/library.rb +12 -0
- data/ffi/bolt/lifecycle.rb +9 -0
- data/ffi/bolt/list.rb +10 -0
- data/ffi/bolt/log.rb +16 -0
- data/ffi/bolt/socket_options.rb +14 -0
- data/ffi/bolt/status.rb +25 -0
- data/ffi/bolt/string.rb +9 -0
- data/ffi/bolt/structure.rb +10 -0
- data/ffi/bolt/value.rb +35 -0
- data/ffi/neo4j/driver.rb +60 -0
- data/ffi/neo4j/driver/access_mode.rb +10 -0
- data/ffi/neo4j/driver/auth_tokens.rb +18 -0
- data/ffi/neo4j/driver/config.rb +40 -0
- data/ffi/neo4j/driver/graph_database.rb +52 -0
- data/ffi/neo4j/driver/internal/async/access_mode_connection.rb +19 -0
- data/ffi/neo4j/driver/internal/async/direct_connection.rb +106 -0
- data/ffi/neo4j/driver/internal/bolt_server_address.rb +18 -0
- data/ffi/neo4j/driver/internal/bookmarks_holder.rb +30 -0
- data/ffi/neo4j/driver/internal/direct_connection_provider.rb +28 -0
- data/ffi/neo4j/driver/internal/driver_factory.rb +125 -0
- data/ffi/neo4j/driver/internal/error_handling.rb +108 -0
- data/ffi/neo4j/driver/internal/explicit_transaction.rb +146 -0
- data/ffi/neo4j/driver/internal/handlers/pull_all_response_handler.rb +105 -0
- data/ffi/neo4j/driver/internal/handlers/response_handler.rb +49 -0
- data/ffi/neo4j/driver/internal/handlers/run_response_handler.rb +32 -0
- data/ffi/neo4j/driver/internal/handlers/session_pull_all_response_handler.rb +32 -0
- data/ffi/neo4j/driver/internal/handlers/transaction_pull_all_response_handler.rb +23 -0
- data/ffi/neo4j/driver/internal/internal_driver.rb +45 -0
- data/ffi/neo4j/driver/internal/internal_logger.rb +32 -0
- data/ffi/neo4j/driver/internal/internal_record.rb +26 -0
- data/ffi/neo4j/driver/internal/internal_resolver.rb +31 -0
- data/ffi/neo4j/driver/internal/internal_statement_result.rb +52 -0
- data/ffi/neo4j/driver/internal/messaging/bolt_protocol.rb +24 -0
- data/ffi/neo4j/driver/internal/messaging/v1/bolt_protocol_v1.rb +59 -0
- data/ffi/neo4j/driver/internal/messaging/v2/bolt_protocol_v2.rb +16 -0
- data/ffi/neo4j/driver/internal/messaging/v3/bolt_protocol_v3.rb +63 -0
- data/ffi/neo4j/driver/internal/network_session.rb +129 -0
- data/ffi/neo4j/driver/internal/retry/exponential_backoff_retry_logic.rb +80 -0
- data/ffi/neo4j/driver/internal/session_factory_impl.rb +28 -0
- data/ffi/neo4j/driver/internal/summary/internal_result_summary.rb +67 -0
- data/ffi/neo4j/driver/internal/summary/internal_server_info.rb +19 -0
- data/ffi/neo4j/driver/internal/summary/internal_summary_counters.rb +23 -0
- data/ffi/neo4j/driver/internal/util/metadata_extractor.rb +15 -0
- data/ffi/neo4j/driver/internal/value/base_time_value.rb +22 -0
- data/ffi/neo4j/driver/internal/value/date_value.rb +25 -0
- data/ffi/neo4j/driver/internal/value/duration_value.rb +27 -0
- data/ffi/neo4j/driver/internal/value/local_date_time_value.rb +24 -0
- data/ffi/neo4j/driver/internal/value/local_time_value.rb +19 -0
- data/ffi/neo4j/driver/internal/value/node_value.rb +18 -0
- data/ffi/neo4j/driver/internal/value/offset_time_value.rb +25 -0
- data/ffi/neo4j/driver/internal/value/path_value.rb +41 -0
- data/ffi/neo4j/driver/internal/value/point2_d_value.rb +24 -0
- data/ffi/neo4j/driver/internal/value/point3_d_value.rb +24 -0
- data/ffi/neo4j/driver/internal/value/relationship_value.rb +18 -0
- data/ffi/neo4j/driver/internal/value/structure_value.rb +42 -0
- data/ffi/neo4j/driver/internal/value/time_with_zone_id_value.rb +25 -0
- data/ffi/neo4j/driver/internal/value/time_with_zone_offset_value.rb +28 -0
- data/ffi/neo4j/driver/internal/value/unbound_relationship_value.rb +18 -0
- data/ffi/neo4j/driver/internal/value/value_adapter.rb +99 -0
- data/ffi/neo4j/driver/net/server_address.rb +13 -0
- data/ffi/neo4j/driver/statement.rb +15 -0
- data/ffi/neo4j/driver/summary/statement_type.rb +14 -0
- data/ffi/neo4j/driver/types/entity.rb +21 -0
- data/ffi/neo4j/driver/types/node.rb +16 -0
- data/ffi/neo4j/driver/types/path.rb +35 -0
- data/ffi/neo4j/driver/types/relationship.rb +19 -0
- data/lib/loader.rb +18 -0
- data/lib/neo4j/driver/auto_closable.rb +32 -0
- data/lib/neo4j/driver/exceptions/authentication_exception.rb +10 -0
- data/lib/neo4j/driver/exceptions/client_exception.rb +15 -0
- data/lib/neo4j/driver/exceptions/database_exception.rb +10 -0
- data/lib/neo4j/driver/exceptions/illegal_state_exception.rb +10 -0
- data/lib/neo4j/driver/exceptions/neo4j_exception.rb +23 -0
- data/lib/neo4j/driver/exceptions/no_such_record_exception.rb +33 -0
- data/lib/neo4j/driver/exceptions/protocol_exception.rb +10 -0
- data/lib/neo4j/driver/exceptions/security_exception.rb +10 -0
- data/lib/neo4j/driver/exceptions/service_unavailable_exception.rb +10 -0
- data/lib/neo4j/driver/exceptions/session_expired_exception.rb +10 -0
- data/lib/neo4j/driver/exceptions/transient_exception.rb +10 -0
- data/lib/neo4j/driver/exceptions/untrusted_server_exception.rb +10 -0
- data/lib/neo4j/driver/internal/duration_normalizer.rb +46 -0
- data/lib/neo4j/driver/internal/ruby_signature.rb +18 -0
- data/lib/neo4j/driver/internal/validator.rb +28 -0
- data/lib/neo4j/driver/types/bytes.rb +10 -0
- data/lib/neo4j/driver/types/local_date_time.rb +20 -0
- data/lib/neo4j/driver/types/local_time.rb +19 -0
- data/lib/neo4j/driver/types/offset_time.rb +19 -0
- data/lib/neo4j/driver/types/point.rb +39 -0
- data/lib/neo4j/driver/types/time.rb +43 -0
- data/lib/neo4j/driver/version.rb +7 -0
- data/lib/neo4j_ruby_driver.rb +20 -0
- metadata +314 -12
@@ -0,0 +1,105 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j
|
4
|
+
module Driver
|
5
|
+
module Internal
|
6
|
+
module Handlers
|
7
|
+
class PullAllResponseHandler < ResponseHandler
|
8
|
+
delegate :bolt_connection, to: :connection
|
9
|
+
delegate :statement_keys, to: :run_handler
|
10
|
+
attr_reader :connection
|
11
|
+
|
12
|
+
def initialize(statement, run_handler, connection, metadata_extractor)
|
13
|
+
super(connection)
|
14
|
+
@statement = statement
|
15
|
+
@previous = run_handler
|
16
|
+
@metadate_extractor = metadata_extractor
|
17
|
+
@records = []
|
18
|
+
end
|
19
|
+
|
20
|
+
def consume
|
21
|
+
@ignore_records = true
|
22
|
+
@records.clear
|
23
|
+
finalize
|
24
|
+
@summary
|
25
|
+
rescue StandardError => e
|
26
|
+
on_failure(e)
|
27
|
+
raise e
|
28
|
+
end
|
29
|
+
|
30
|
+
def summary
|
31
|
+
unless @finished
|
32
|
+
while (record = fetch)
|
33
|
+
@records << record
|
34
|
+
end
|
35
|
+
end
|
36
|
+
@summary ||= Summary::InternalResultSummary.new(@statement, run_handler.result_available_after,
|
37
|
+
bolt_connection)
|
38
|
+
end
|
39
|
+
|
40
|
+
def peek
|
41
|
+
@records.first || ((@records << fetch).first unless @finished)
|
42
|
+
end
|
43
|
+
|
44
|
+
def next
|
45
|
+
peek
|
46
|
+
@records.shift
|
47
|
+
end
|
48
|
+
|
49
|
+
def on_success
|
50
|
+
@finished = true
|
51
|
+
summary
|
52
|
+
|
53
|
+
after_success(nil)
|
54
|
+
|
55
|
+
@failure = nil
|
56
|
+
end
|
57
|
+
|
58
|
+
def failure
|
59
|
+
summary
|
60
|
+
super
|
61
|
+
end
|
62
|
+
|
63
|
+
def on_failure(error)
|
64
|
+
summary
|
65
|
+
@finished = true
|
66
|
+
|
67
|
+
after_failure(error)
|
68
|
+
|
69
|
+
@failure = error
|
70
|
+
end
|
71
|
+
|
72
|
+
def finalize
|
73
|
+
summary unless @ignore_records
|
74
|
+
super
|
75
|
+
end
|
76
|
+
|
77
|
+
private
|
78
|
+
|
79
|
+
def run_handler
|
80
|
+
@previous
|
81
|
+
end
|
82
|
+
|
83
|
+
def fetch
|
84
|
+
run_handler.finalize
|
85
|
+
bolt_connection_fetch = Bolt::Connection.fetch(bolt_connection, request)
|
86
|
+
case bolt_connection_fetch
|
87
|
+
when -1
|
88
|
+
check_status(Bolt::Connection.status(bolt_connection))
|
89
|
+
when 1
|
90
|
+
InternalRecord.new(run_handler.statement_keys,
|
91
|
+
Value::ValueAdapter.to_ruby(Bolt::Connection.field_values(bolt_connection)))
|
92
|
+
else
|
93
|
+
@finished = true
|
94
|
+
check_summary_failure
|
95
|
+
nil
|
96
|
+
end
|
97
|
+
rescue StandardError => e
|
98
|
+
on_failure(e)
|
99
|
+
raise e
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j
|
4
|
+
module Driver
|
5
|
+
module Internal
|
6
|
+
module Handlers
|
7
|
+
class ResponseHandler
|
8
|
+
include ErrorHandling
|
9
|
+
|
10
|
+
delegate :bolt_connection, to: :connection
|
11
|
+
attr_reader :connection, :failure
|
12
|
+
attr_accessor :request, :previous
|
13
|
+
|
14
|
+
def initialize(connection)
|
15
|
+
@connection = connection
|
16
|
+
end
|
17
|
+
|
18
|
+
def finalize
|
19
|
+
return if @finished
|
20
|
+
@finished = true
|
21
|
+
begin
|
22
|
+
previous&.finalize
|
23
|
+
ensure
|
24
|
+
Bolt::Connection.fetch_summary(bolt_connection, request)
|
25
|
+
check_summary_failure
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def check_summary_failure
|
32
|
+
summary
|
33
|
+
if Bolt::Connection.summary_success(bolt_connection) == 1
|
34
|
+
after_success(nil)
|
35
|
+
else
|
36
|
+
return if previous&.failure
|
37
|
+
@failure = Value::ValueAdapter.to_ruby(Bolt::Connection.failure(bolt_connection))
|
38
|
+
raise new_neo4j_error(**@failure)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def summary; end
|
43
|
+
|
44
|
+
def after_success(metadata); end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j
|
4
|
+
module Driver
|
5
|
+
module Internal
|
6
|
+
module Handlers
|
7
|
+
class RunResponseHandler < ResponseHandler
|
8
|
+
attr_reader :result_available_after
|
9
|
+
|
10
|
+
def initialize(connection, metadata_extractor)
|
11
|
+
super(connection)
|
12
|
+
@statement_keys = []
|
13
|
+
@metadata_extractor = metadata_extractor
|
14
|
+
end
|
15
|
+
|
16
|
+
def statement_keys
|
17
|
+
finalize
|
18
|
+
@statement_keys
|
19
|
+
end
|
20
|
+
|
21
|
+
def finalize
|
22
|
+
return if @finished
|
23
|
+
super
|
24
|
+
@statement_keys = Value::ValueAdapter.to_ruby(Bolt::Connection.field_names(bolt_connection)).map(&:to_sym)
|
25
|
+
metadata = Value::ValueAdapter.to_ruby(Bolt::Connection.metadata(bolt_connection))
|
26
|
+
@result_available_after = metadata[:result_available_after] || metadata[:t_first]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j
|
4
|
+
module Driver
|
5
|
+
module Internal
|
6
|
+
module Handlers
|
7
|
+
class SessionPullAllResponseHandler < PullAllResponseHandler
|
8
|
+
def initialize(statement, run_handler, connection, bookmarks_holder, metadata_extractor)
|
9
|
+
super(statement, run_handler, connection, metadata_extractor)
|
10
|
+
@bookmarks_holder = bookmarks_holder
|
11
|
+
end
|
12
|
+
|
13
|
+
def after_success(metadata)
|
14
|
+
@bookmarks_holder.bookmarks = connection.last_bookmark
|
15
|
+
release_connection
|
16
|
+
# @bookmarks_holder.bookmarks = @metadata_extractor.extract_bookmarks(metadata)
|
17
|
+
end
|
18
|
+
|
19
|
+
def after_failure(_error)
|
20
|
+
release_connection
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def release_connection
|
26
|
+
connection.release
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j
|
4
|
+
module Driver
|
5
|
+
module Internal
|
6
|
+
module Handlers
|
7
|
+
class TransactionPullAllResponseHandler < PullAllResponseHandler
|
8
|
+
def initialize(statement, run_handler, connection, tx, metadata_extractor)
|
9
|
+
super(statement, run_handler, connection, metadata_extractor)
|
10
|
+
@tx = tx
|
11
|
+
@tx.chain run_handler, self
|
12
|
+
end
|
13
|
+
|
14
|
+
def after_success(_metadata); end
|
15
|
+
|
16
|
+
def after_failure(_error)
|
17
|
+
@tx.mark_terminated
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j
|
4
|
+
module Driver
|
5
|
+
module Internal
|
6
|
+
class InternalDriver
|
7
|
+
extend AutoClosable
|
8
|
+
include ErrorHandling
|
9
|
+
|
10
|
+
attr_reader :session_factory
|
11
|
+
delegate :verify_connectivity, to: :session_factory
|
12
|
+
auto_closable :session
|
13
|
+
|
14
|
+
def initialize(session_factory, logger, resolver)
|
15
|
+
@session_factory = session_factory
|
16
|
+
@closed = Concurrent::AtomicBoolean.new(false)
|
17
|
+
# The below hold references to callbacks called from c,
|
18
|
+
# this prevents garbage collection before driver is garbage collected
|
19
|
+
@logger = logger
|
20
|
+
@resolver = resolver
|
21
|
+
end
|
22
|
+
|
23
|
+
def session(*args)
|
24
|
+
new_session(*Neo4j::Driver::Internal::RubySignature.session(args))
|
25
|
+
end
|
26
|
+
|
27
|
+
def close
|
28
|
+
session_factory.close if @closed.make_true
|
29
|
+
# Bolt::Connector.destroy(@connector)
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def new_session(mode, bookmarks)
|
35
|
+
assert_open
|
36
|
+
session_factory.new_instance(mode, bookmarks)
|
37
|
+
end
|
38
|
+
|
39
|
+
def assert_open
|
40
|
+
raise Exceptions::IllegalStateException, 'This driver instance has already been closed' if @closed.true?
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j
|
4
|
+
module Driver
|
5
|
+
module Internal
|
6
|
+
class InternalLogger
|
7
|
+
include ErrorHandling
|
8
|
+
|
9
|
+
class << self
|
10
|
+
def register(bolt_config, logger)
|
11
|
+
return unless logger
|
12
|
+
new(bolt_config, logger)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(bolt_config, logger)
|
17
|
+
@logger = logger
|
18
|
+
@funcs = []
|
19
|
+
bolt_log = Bolt::Log.create(nil)
|
20
|
+
%i[error warning info debug].each do |method|
|
21
|
+
Bolt::Log.send("set_#{method}_func", bolt_log, func(method))
|
22
|
+
end
|
23
|
+
check_error Bolt::Config.set_log(bolt_config, bolt_log)
|
24
|
+
end
|
25
|
+
|
26
|
+
def func(method)
|
27
|
+
Proc.new { |_ptr, message| @logger.send(method, message) }.tap(&@funcs.method(:<<))
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j
|
4
|
+
module Driver
|
5
|
+
module Internal
|
6
|
+
class InternalRecord
|
7
|
+
attr_reader :keys, :values
|
8
|
+
delegate :first, to: :values
|
9
|
+
|
10
|
+
def initialize(keys, values)
|
11
|
+
@keys = keys
|
12
|
+
@values = values
|
13
|
+
end
|
14
|
+
|
15
|
+
def [](key)
|
16
|
+
field_index = key.is_a?(Integer) ? key : @keys.index(key.to_sym)
|
17
|
+
@values[field_index] if field_index
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_h
|
21
|
+
keys.zip(values).to_h
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j
|
4
|
+
module Driver
|
5
|
+
module Internal
|
6
|
+
class InternalResolver
|
7
|
+
include ErrorHandling
|
8
|
+
|
9
|
+
class << self
|
10
|
+
def register(bolt_config, resolver)
|
11
|
+
return unless resolver
|
12
|
+
new(bolt_config, resolver)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(bolt_config, resolver)
|
17
|
+
@address_resolver_func = ->(_ptr, address, set) {
|
18
|
+
resolver.call(BoltServerAddress.new(Bolt::Address.host(address).first,
|
19
|
+
Bolt::Address.port(address).first.to_i)).each do |server_address|
|
20
|
+
bolt_address = Bolt::Address.create(server_address.host, server_address.port.to_s)
|
21
|
+
check_error Bolt::AddressSet.add(set, bolt_address)
|
22
|
+
end
|
23
|
+
}
|
24
|
+
|
25
|
+
address_resolver = Bolt::AddressResolver.create(nil, @address_resolver_func)
|
26
|
+
check_error Bolt::Config.set_address_resolver(bolt_config, address_resolver)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j
|
4
|
+
module Driver
|
5
|
+
module Internal
|
6
|
+
class InternalStatementResult
|
7
|
+
include Enumerable
|
8
|
+
|
9
|
+
delegate :consume, :failure, :summary, :finalize, to: :@pull_all_handler
|
10
|
+
|
11
|
+
def initialize(run_handler, pull_all_handler)
|
12
|
+
@run_handler = run_handler
|
13
|
+
@pull_all_handler = pull_all_handler
|
14
|
+
end
|
15
|
+
|
16
|
+
def single
|
17
|
+
@pull_all_handler.next.tap do |record|
|
18
|
+
raise Exceptions::NoSuchRecordException.empty unless record
|
19
|
+
raise Exceptions::NoSuchRecordException.too_many if has_next?
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def next
|
24
|
+
@pull_all_handler.next.tap do |record|
|
25
|
+
raise Exceptions::NoSuchRecordException.no_more unless record
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def peek
|
30
|
+
@pull_all_handler.peek.tap do |record|
|
31
|
+
raise Exceptions::NoSuchRecordException.no_peek_past unless record
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def has_next?
|
36
|
+
@pull_all_handler.peek
|
37
|
+
end
|
38
|
+
|
39
|
+
def each
|
40
|
+
yield @pull_all_handler.next while has_next?
|
41
|
+
end
|
42
|
+
|
43
|
+
def keys
|
44
|
+
@keys ||= begin
|
45
|
+
@pull_all_handler.peek
|
46
|
+
@pull_all_handler.statement_keys
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j
|
4
|
+
module Driver
|
5
|
+
module Internal
|
6
|
+
module Messaging
|
7
|
+
module BoltProtocol
|
8
|
+
def self.for_version(version)
|
9
|
+
case version
|
10
|
+
when V1::BoltProtocolV1::VERSION
|
11
|
+
V1::BoltProtocolV1::INSTANCE
|
12
|
+
when V2::BoltProtocolV2::VERSION
|
13
|
+
V2::BoltProtocolV2::INSTANCE
|
14
|
+
when V3::BoltProtocolV3::VERSION
|
15
|
+
V3::BoltProtocolV3::INSTANCE
|
16
|
+
else
|
17
|
+
raise Exceptions::ClientException, "Unknown protocol version: #{version}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|