neo4j-ruby-driver 1.7.5 → 4.4.0.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -42
- data/lib/loader.rb +5 -3
- data/lib/neo4j/driver/auto_closable.rb +2 -2
- data/lib/neo4j/driver/exceptions/authentication_exception.rb +6 -1
- data/lib/neo4j/driver/exceptions/authorization_expired_exception.rb +14 -0
- data/lib/neo4j/driver/{types/bytes.rb → exceptions/certificate_exception.rb} +2 -2
- data/lib/neo4j/driver/exceptions/client_exception.rb +3 -0
- data/lib/neo4j/driver/exceptions/connection_read_timeout_exception.rb +14 -0
- data/lib/neo4j/driver/exceptions/database_exception.rb +3 -0
- data/lib/neo4j/driver/exceptions/discovery_exception.rb +16 -0
- data/lib/neo4j/driver/exceptions/fatal_discovery_exception.rb +13 -0
- data/lib/neo4j/driver/exceptions/protocol_exception.rb +7 -0
- data/lib/neo4j/driver/exceptions/result_consumed_exception.rb +13 -0
- data/lib/neo4j/driver/exceptions/security_exception.rb +5 -1
- data/lib/neo4j/driver/exceptions/service_unavailable_exception.rb +2 -0
- data/lib/neo4j/driver/exceptions/session_expired_exception.rb +4 -0
- data/lib/neo4j/driver/exceptions/token_expired_exception.rb +15 -0
- data/lib/neo4j/driver/exceptions/transaction_nesting_exception.rb +11 -0
- data/lib/neo4j/driver/exceptions/transient_exception.rb +3 -0
- data/lib/neo4j/driver/exceptions/untrusted_server_exception.rb +1 -0
- data/lib/neo4j/driver/exceptions/value/lossy_coercion.rb +15 -0
- data/lib/neo4j/driver/exceptions/value/not_multi_valued.rb +13 -0
- data/lib/neo4j/driver/exceptions/value/uncoercible.rb +15 -0
- data/lib/neo4j/driver/exceptions/value/unsizable.rb +12 -0
- data/lib/neo4j/driver/exceptions/value/value_exception.rb +12 -0
- data/lib/neo4j/driver/internal/bolt_server_address.rb +97 -0
- data/lib/neo4j/driver/internal/duration_normalizer.rb +1 -1
- data/lib/neo4j/driver/internal/validator.rb +5 -4
- data/{ffi/neo4j/driver/summary/statement_type.rb → lib/neo4j/driver/summary/query_type.rb} +1 -3
- data/lib/neo4j/driver/synchronizable.rb +23 -0
- data/lib/neo4j_ruby_driver.rb +5 -10
- data/{ffi → ruby}/neo4j/driver/access_mode.rb +2 -2
- data/ruby/neo4j/driver/auth_tokens.rb +34 -0
- data/ruby/neo4j/driver/bookmark.rb +21 -0
- data/ruby/neo4j/driver/config.rb +91 -0
- data/ruby/neo4j/driver/graph_database.rb +140 -0
- data/ruby/neo4j/driver/internal/async/connection/bolt_protocol_util.rb +51 -0
- data/ruby/neo4j/driver/internal/async/connection/bootstrap_factory.rb +22 -0
- data/ruby/neo4j/driver/internal/async/connection/channel_attributes.rb +31 -0
- data/ruby/neo4j/driver/internal/async/connection/channel_connected_listener.rb +32 -0
- data/ruby/neo4j/driver/internal/async/connection/channel_connector_impl.rb +77 -0
- data/ruby/neo4j/driver/internal/async/connection/channel_pipeline_builder_impl.rb +22 -0
- data/ruby/neo4j/driver/internal/async/connection/direct_connection.rb +30 -0
- data/ruby/neo4j/driver/internal/async/connection/event_loop_group_factory.rb +83 -0
- data/ruby/neo4j/driver/internal/async/connection/handshake_completed_listener.rb +27 -0
- data/ruby/neo4j/driver/internal/async/connection/handshake_handler.rb +113 -0
- data/ruby/neo4j/driver/internal/async/connection/netty_channel_initializer.rb +57 -0
- data/ruby/neo4j/driver/internal/async/connection/netty_domain_name_resolver.rb +26 -0
- data/ruby/neo4j/driver/internal/async/connection/netty_domain_name_resolver_group.rb +19 -0
- data/ruby/neo4j/driver/internal/async/connection/routing_connection.rb +36 -0
- data/ruby/neo4j/driver/internal/async/connection/stream.rb +12 -0
- data/ruby/neo4j/driver/internal/async/connection/stream_reader.rb +16 -0
- data/ruby/neo4j/driver/internal/async/connection_context.rb +10 -0
- data/ruby/neo4j/driver/internal/async/immutable_connection_context.rb +24 -0
- data/ruby/neo4j/driver/internal/async/inbound/byte_buf_input.rb +30 -0
- data/ruby/neo4j/driver/internal/async/inbound/channel_error_handler.rb +77 -0
- data/ruby/neo4j/driver/internal/async/inbound/chunk_decoder.rb +41 -0
- data/ruby/neo4j/driver/internal/async/inbound/connect_timeout_handler.rb +32 -0
- data/ruby/neo4j/driver/internal/async/inbound/connection_read_timeout_handler.rb +17 -0
- data/ruby/neo4j/driver/internal/async/inbound/inbound_message_dispatcher.rb +172 -0
- data/ruby/neo4j/driver/internal/async/inbound/inbound_message_handler.rb +42 -0
- data/ruby/neo4j/driver/internal/async/inbound/message_decoder.rb +51 -0
- data/ruby/neo4j/driver/internal/async/internal_async_session.rb +98 -0
- data/ruby/neo4j/driver/internal/async/internal_async_transaction.rb +13 -0
- data/ruby/neo4j/driver/internal/async/leak_logging_network_session.rb +34 -0
- data/ruby/neo4j/driver/internal/async/network_connection.rb +196 -0
- data/ruby/neo4j/driver/internal/async/network_session.rb +152 -0
- data/ruby/neo4j/driver/internal/async/outbound/chunk_aware_byte_buf_output.rb +110 -0
- data/ruby/neo4j/driver/internal/async/outbound/outbound_message_handler.rb +39 -0
- data/ruby/neo4j/driver/internal/async/pool/channel.rb +63 -0
- data/ruby/neo4j/driver/internal/async/pool/connection_pool_impl.rb +149 -0
- data/ruby/neo4j/driver/internal/async/pool/controller.rb +25 -0
- data/ruby/neo4j/driver/internal/async/pool/netty_channel_health_checker.rb +87 -0
- data/ruby/neo4j/driver/internal/async/pool/netty_channel_pool.rb +52 -0
- data/ruby/neo4j/driver/internal/async/pool/netty_channel_tracker.rb +137 -0
- data/ruby/neo4j/driver/internal/async/pool/network_connection_factory.rb +21 -0
- data/ruby/neo4j/driver/internal/async/pool/pool_settings.rb +34 -0
- data/ruby/neo4j/driver/internal/async/result_cursors_holder.rb +17 -0
- data/ruby/neo4j/driver/internal/async/unmanaged_transaction.rb +214 -0
- data/ruby/neo4j/driver/internal/bookmark_holder.rb +9 -0
- data/ruby/neo4j/driver/internal/cluster/cluster_composition.rb +58 -0
- data/ruby/neo4j/driver/internal/cluster/cluster_composition_lookup_result.rb +14 -0
- data/ruby/neo4j/driver/internal/cluster/cluster_routing_table.rb +139 -0
- data/ruby/neo4j/driver/internal/cluster/identity_resolver.rb +13 -0
- data/ruby/neo4j/driver/internal/cluster/loadbalancing/least_connected_load_balancing_strategy.rb +68 -0
- data/ruby/neo4j/driver/internal/cluster/loadbalancing/load_balancer.rb +159 -0
- data/ruby/neo4j/driver/internal/cluster/loadbalancing/round_robin_array_index.rb +13 -0
- data/ruby/neo4j/driver/internal/cluster/multi_databases_routing_procedure_runner.rb +34 -0
- data/ruby/neo4j/driver/internal/cluster/rediscovery_impl.rb +238 -0
- data/ruby/neo4j/driver/internal/cluster/route_message_routing_procedure_runner.rb +43 -0
- data/ruby/neo4j/driver/internal/cluster/routing_context.rb +77 -0
- data/ruby/neo4j/driver/internal/cluster/routing_procedure_cluster_composition_provider.rb +64 -0
- data/ruby/neo4j/driver/internal/cluster/routing_procedure_response.rb +19 -0
- data/ruby/neo4j/driver/internal/cluster/routing_settings.rb +24 -0
- data/ruby/neo4j/driver/internal/cluster/routing_table_handler_impl.rb +116 -0
- data/ruby/neo4j/driver/internal/cluster/routing_table_registry_impl.rb +140 -0
- data/ruby/neo4j/driver/internal/cluster/single_database_routing_procedure_runner.rb +76 -0
- data/ruby/neo4j/driver/internal/connection_settings.rb +16 -0
- data/ruby/neo4j/driver/internal/cursor/async_result_cursor_impl.rb +76 -0
- data/ruby/neo4j/driver/internal/cursor/async_result_cursor_only_factory.rb +29 -0
- data/ruby/neo4j/driver/internal/cursor/disposable_async_result_cursor.rb +59 -0
- data/ruby/neo4j/driver/internal/cursor/result_cursor_factory_impl.rb +29 -0
- data/ruby/neo4j/driver/internal/cursor/rx_result_cursor_impl.rb +110 -0
- data/ruby/neo4j/driver/internal/database_name.rb +12 -0
- data/ruby/neo4j/driver/internal/database_name_util.rb +37 -0
- data/ruby/neo4j/driver/internal/default_bookmark_holder.rb +15 -0
- data/ruby/neo4j/driver/internal/default_domain_name_resolver.rb +11 -0
- data/ruby/neo4j/driver/internal/direct_connection_provider.rb +40 -0
- data/ruby/neo4j/driver/internal/driver_factory.rb +127 -0
- data/ruby/neo4j/driver/internal/handlers/begin_tx_response_handler.rb +20 -0
- data/ruby/neo4j/driver/internal/handlers/channel_releasing_reset_response_handler.rb +29 -0
- data/ruby/neo4j/driver/internal/handlers/commit_tx_response_handler.rb +25 -0
- data/ruby/neo4j/driver/internal/handlers/hello_response_handler.rb +65 -0
- data/ruby/neo4j/driver/internal/handlers/init_response_handler.rb +34 -0
- data/ruby/neo4j/driver/internal/handlers/legacy_pull_all_response_handler.rb +228 -0
- data/ruby/neo4j/driver/internal/handlers/no_op_response_handler.rb +16 -0
- data/ruby/neo4j/driver/internal/handlers/ping_response_handler.rb +29 -0
- data/ruby/neo4j/driver/internal/handlers/pull_handlers.rb +32 -0
- data/ruby/neo4j/driver/internal/handlers/pulln/auto_pull_response_handler.rb +174 -0
- data/ruby/neo4j/driver/internal/handlers/pulln/basic_pull_response_handler.rb +288 -0
- data/ruby/neo4j/driver/internal/handlers/pulln/fetch_size_util.rb +20 -0
- data/ruby/neo4j/driver/internal/handlers/reset_response_handler.rb +34 -0
- data/ruby/neo4j/driver/internal/handlers/rollback_tx_response_handler.rb +19 -0
- data/ruby/neo4j/driver/internal/handlers/route_message_response_handler.rb +21 -0
- data/ruby/neo4j/driver/internal/handlers/routing_response_handler.rb +70 -0
- data/ruby/neo4j/driver/internal/handlers/run_response_handler.rb +37 -0
- data/ruby/neo4j/driver/internal/handlers/session_pull_response_completion_listener.rb +34 -0
- data/ruby/neo4j/driver/internal/handlers/transaction_pull_response_completion_listener.rb +20 -0
- data/ruby/neo4j/driver/internal/impersonation_util.rb +22 -0
- data/ruby/neo4j/driver/internal/internal_bookmark.rb +38 -0
- data/ruby/neo4j/driver/internal/internal_database_name.rb +11 -0
- data/ruby/neo4j/driver/internal/internal_driver.rb +78 -0
- data/ruby/neo4j/driver/internal/internal_entity.rb +22 -0
- data/ruby/neo4j/driver/internal/internal_node.rb +21 -0
- data/ruby/neo4j/driver/internal/internal_pair.rb +9 -0
- data/ruby/neo4j/driver/internal/internal_path.rb +35 -0
- data/ruby/neo4j/driver/internal/internal_point2_d.rb +9 -0
- data/ruby/neo4j/driver/internal/internal_point3_d.rb +6 -0
- data/{ffi → ruby}/neo4j/driver/internal/internal_record.rb +2 -1
- data/ruby/neo4j/driver/internal/internal_relationship.rb +26 -0
- data/ruby/neo4j/driver/internal/internal_result.rb +60 -0
- data/ruby/neo4j/driver/internal/internal_session.rb +81 -0
- data/ruby/neo4j/driver/internal/internal_transaction.rb +48 -0
- data/ruby/neo4j/driver/internal/logging/channel_activity_logger.rb +29 -0
- data/ruby/neo4j/driver/internal/logging/channel_error_logger.rb +17 -0
- data/ruby/neo4j/driver/internal/logging/prefixed_logger.rb +19 -0
- data/ruby/neo4j/driver/internal/logging/reformatted_logger.rb +17 -0
- data/ruby/neo4j/driver/internal/messaging/abstract_message_writer.rb +23 -0
- data/ruby/neo4j/driver/internal/messaging/bolt_protocol.rb +30 -0
- data/ruby/neo4j/driver/internal/messaging/bolt_protocol_version.rb +46 -0
- data/ruby/neo4j/driver/internal/messaging/common/common_message_reader.rb +51 -0
- data/ruby/neo4j/driver/internal/messaging/common/common_value.rb +31 -0
- data/ruby/neo4j/driver/internal/messaging/common/common_value_packer.rb +101 -0
- data/ruby/neo4j/driver/internal/messaging/common/common_value_unpacker.rb +234 -0
- data/ruby/neo4j/driver/internal/messaging/encode/begin_message_encoder.rb +15 -0
- data/ruby/neo4j/driver/internal/messaging/encode/commit_message_encoder.rb +14 -0
- data/ruby/neo4j/driver/internal/messaging/encode/discard_all_message_encoder.rb +14 -0
- data/ruby/neo4j/driver/internal/messaging/encode/discard_message_encoder.rb +15 -0
- data/ruby/neo4j/driver/internal/messaging/encode/goodbye_message_encoder.rb +14 -0
- data/ruby/neo4j/driver/internal/messaging/encode/hello_message_encoder.rb +15 -0
- data/ruby/neo4j/driver/internal/messaging/encode/init_message_encoder.rb +16 -0
- data/ruby/neo4j/driver/internal/messaging/encode/pull_all_message_encoder.rb +14 -0
- data/ruby/neo4j/driver/internal/messaging/encode/pull_message_encoder.rb +15 -0
- data/ruby/neo4j/driver/internal/messaging/encode/reset_message_encoder.rb +14 -0
- data/ruby/neo4j/driver/internal/messaging/encode/rollback_message_encoder.rb +14 -0
- data/ruby/neo4j/driver/internal/messaging/encode/route_message_encoder.rb +18 -0
- data/ruby/neo4j/driver/internal/messaging/encode/route_v44_message_encoder.rb +27 -0
- data/ruby/neo4j/driver/internal/messaging/encode/run_message_encoder.rb +16 -0
- data/ruby/neo4j/driver/internal/messaging/encode/run_with_metadata_message_encoder.rb +17 -0
- data/ruby/neo4j/driver/internal/messaging/request/abstract_streaming_message.rb +22 -0
- data/ruby/neo4j/driver/internal/messaging/request/begin_message.rb +26 -0
- data/ruby/neo4j/driver/internal/messaging/request/commit_message.rb +20 -0
- data/ruby/neo4j/driver/internal/messaging/request/discard_all_message.rb +20 -0
- data/ruby/neo4j/driver/internal/messaging/request/discard_message.rb +23 -0
- data/ruby/neo4j/driver/internal/messaging/request/goodbye_message.rb +20 -0
- data/ruby/neo4j/driver/internal/messaging/request/hello_message.rb +31 -0
- data/ruby/neo4j/driver/internal/messaging/request/init_message.rb +19 -0
- data/ruby/neo4j/driver/internal/messaging/request/message_with_metadata.rb +10 -0
- data/ruby/neo4j/driver/internal/messaging/request/multi_database_util.rb +26 -0
- data/ruby/neo4j/driver/internal/messaging/request/pull_all_message.rb +23 -0
- data/ruby/neo4j/driver/internal/messaging/request/pull_message.rb +22 -0
- data/ruby/neo4j/driver/internal/messaging/request/reset_message.rb +32 -0
- data/ruby/neo4j/driver/internal/messaging/request/rollback_message.rb +20 -0
- data/ruby/neo4j/driver/internal/messaging/request/route_message.rb +33 -0
- data/ruby/neo4j/driver/internal/messaging/request/run_message.rb +23 -0
- data/ruby/neo4j/driver/internal/messaging/request/run_with_metadata_message.rb +47 -0
- data/ruby/neo4j/driver/internal/messaging/request/transaction_metadata_builder.rb +24 -0
- data/ruby/neo4j/driver/internal/messaging/response/failure_message.rb +40 -0
- data/ruby/neo4j/driver/internal/messaging/response/ignored_message.rb +29 -0
- data/ruby/neo4j/driver/internal/messaging/response/record_message.rb +33 -0
- data/ruby/neo4j/driver/internal/messaging/response/success_message.rb +34 -0
- data/ruby/neo4j/driver/internal/messaging/v3/bolt_protocol_v3.rb +79 -0
- data/ruby/neo4j/driver/internal/messaging/v3/message_format_v3.rb +17 -0
- data/ruby/neo4j/driver/internal/messaging/v3/message_writer_v3.rb +27 -0
- data/ruby/neo4j/driver/internal/messaging/v4/bolt_protocol_v4.rb +29 -0
- data/ruby/neo4j/driver/internal/messaging/v4/message_format_v4.rb +17 -0
- data/ruby/neo4j/driver/internal/messaging/v4/message_writer_v4.rb +28 -0
- data/ruby/neo4j/driver/internal/messaging/v41/bolt_protocol_v41.rb +25 -0
- data/ruby/neo4j/driver/internal/messaging/v42/bolt_protocol_v42.rb +13 -0
- data/ruby/neo4j/driver/internal/messaging/v43/bolt_protocol_v43.rb +19 -0
- data/ruby/neo4j/driver/internal/messaging/v43/message_format_v43.rb +18 -0
- data/ruby/neo4j/driver/internal/messaging/v43/message_writer_v43.rb +34 -0
- data/ruby/neo4j/driver/internal/messaging/v44/bolt_protocol_v44.rb +17 -0
- data/ruby/neo4j/driver/internal/messaging/v44/message_format_v44.rb +18 -0
- data/ruby/neo4j/driver/internal/messaging/v44/message_writer_v44.rb +26 -0
- data/ruby/neo4j/driver/internal/metrics/connection_pool_metrics_listener.rb +34 -0
- data/ruby/neo4j/driver/internal/metrics/internal_abstract_metrics.rb +46 -0
- data/ruby/neo4j/driver/internal/metrics/internal_connection_pool_metrics.rb +105 -0
- data/ruby/neo4j/driver/internal/metrics/internal_metrics.rb +82 -0
- data/ruby/neo4j/driver/internal/metrics/internal_metrics_provider.rb +18 -0
- data/ruby/neo4j/driver/internal/metrics/listener_event.rb +17 -0
- data/ruby/neo4j/driver/internal/metrics/metrics_provider.rb +24 -0
- data/ruby/neo4j/driver/internal/metrics/time_recorder_listener_event.rb +15 -0
- data/ruby/neo4j/driver/internal/packstream/byte_array_incompatible_packer.rb +12 -0
- data/ruby/neo4j/driver/internal/packstream/pack_input.rb +47 -0
- data/ruby/neo4j/driver/internal/packstream/pack_output.rb +39 -0
- data/ruby/neo4j/driver/internal/packstream/pack_stream.rb +326 -0
- data/ruby/neo4j/driver/internal/packstream/pack_type.rb +17 -0
- data/ruby/neo4j/driver/internal/retry/exponential_backoff_retry_logic.rb +151 -0
- data/ruby/neo4j/driver/internal/revocation_strategy.rb +19 -0
- data/ruby/neo4j/driver/internal/scheme.rb +32 -0
- data/ruby/neo4j/driver/internal/security/internal_auth_token.rb +15 -0
- data/ruby/neo4j/driver/internal/security/security_plan_impl.rb +92 -0
- data/ruby/neo4j/driver/internal/security_setting.rb +73 -0
- data/ruby/neo4j/driver/internal/session_factory_impl.rb +32 -0
- data/ruby/neo4j/driver/internal/spi/connection.rb +19 -0
- data/ruby/neo4j/driver/internal/spi/connection_pool.rb +9 -0
- data/ruby/neo4j/driver/internal/spi/response_handler.rb +23 -0
- data/ruby/neo4j/driver/internal/summary/internal_database_info.rb +7 -0
- data/ruby/neo4j/driver/internal/summary/internal_input_position.rb +11 -0
- data/ruby/neo4j/driver/internal/summary/internal_notification.rb +16 -0
- data/ruby/neo4j/driver/internal/summary/internal_plan.rb +41 -0
- data/ruby/neo4j/driver/internal/summary/internal_profiled_plan.rb +32 -0
- data/ruby/neo4j/driver/internal/summary/internal_result_summary.rb +33 -0
- data/ruby/neo4j/driver/internal/summary/internal_server_info.rb +6 -0
- data/ruby/neo4j/driver/internal/summary/internal_summary_counters.rb +18 -0
- data/ruby/neo4j/driver/internal/svm/netty_substitutions.rb +196 -0
- data/ruby/neo4j/driver/internal/svm/z_lib_substitutions.rb +21 -0
- data/ruby/neo4j/driver/internal/util/certificate_tool.rb +65 -0
- data/ruby/neo4j/driver/internal/util/clock.rb +29 -0
- data/ruby/neo4j/driver/internal/util/error_util.rb +104 -0
- data/ruby/neo4j/driver/internal/util/extract.rb +123 -0
- data/ruby/neo4j/driver/internal/util/format.rb +39 -0
- data/ruby/neo4j/driver/internal/util/futures.rb +99 -0
- data/ruby/neo4j/driver/internal/util/iterables.rb +35 -0
- data/ruby/neo4j/driver/internal/util/lock_util.rb +23 -0
- data/ruby/neo4j/driver/internal/util/metadata_extractor.rb +109 -0
- data/ruby/neo4j/driver/internal/util/mutex.rb +9 -0
- data/ruby/neo4j/driver/internal/util/preconditions.rb +16 -0
- data/ruby/neo4j/driver/internal/util/server_version.rb +60 -0
- data/ruby/neo4j/driver/logging1.rb +51 -0
- data/ruby/neo4j/driver/net/server_address1.rb +9 -0
- data/ruby/neo4j/driver/query.rb +48 -0
- data/ruby/neo4j/driver/records.rb +13 -0
- data/ruby/neo4j/driver/session_config.rb +15 -0
- data/ruby/neo4j/driver/transaction_config.rb +46 -0
- data/ruby/neo4j/driver/values.rb +26 -0
- data/{lib → ruby}/neo4j/driver/version.rb +1 -1
- data/ruby/neo4j/driver.rb +30 -0
- metadata +267 -92
- data/ffi/bolt/address.rb +0 -11
- data/ffi/bolt/address_resolver.rb +0 -12
- data/ffi/bolt/address_set.rb +0 -9
- data/ffi/bolt/auth.rb +0 -10
- data/ffi/bolt/auto_releasable.rb +0 -22
- data/ffi/bolt/boolean.rb +0 -9
- data/ffi/bolt/bytes.rb +0 -10
- data/ffi/bolt/config.rb +0 -45
- data/ffi/bolt/connection.rb +0 -44
- data/ffi/bolt/connector.rb +0 -17
- data/ffi/bolt/dictionary.rb +0 -15
- data/ffi/bolt/error.rb +0 -74
- data/ffi/bolt/float.rb +0 -9
- data/ffi/bolt/integer.rb +0 -9
- data/ffi/bolt/library.rb +0 -12
- data/ffi/bolt/lifecycle.rb +0 -9
- data/ffi/bolt/list.rb +0 -10
- data/ffi/bolt/log.rb +0 -16
- data/ffi/bolt/socket_options.rb +0 -14
- data/ffi/bolt/status.rb +0 -25
- data/ffi/bolt/string.rb +0 -9
- data/ffi/bolt/structure.rb +0 -10
- data/ffi/bolt/value.rb +0 -35
- data/ffi/neo4j/driver/auth_tokens.rb +0 -18
- data/ffi/neo4j/driver/config.rb +0 -40
- data/ffi/neo4j/driver/graph_database.rb +0 -52
- data/ffi/neo4j/driver/internal/async/access_mode_connection.rb +0 -19
- data/ffi/neo4j/driver/internal/async/direct_connection.rb +0 -106
- data/ffi/neo4j/driver/internal/bolt_server_address.rb +0 -18
- data/ffi/neo4j/driver/internal/bookmarks_holder.rb +0 -30
- data/ffi/neo4j/driver/internal/direct_connection_provider.rb +0 -28
- data/ffi/neo4j/driver/internal/driver_factory.rb +0 -126
- data/ffi/neo4j/driver/internal/error_handling.rb +0 -112
- data/ffi/neo4j/driver/internal/explicit_transaction.rb +0 -146
- data/ffi/neo4j/driver/internal/handlers/pull_all_response_handler.rb +0 -104
- data/ffi/neo4j/driver/internal/handlers/response_handler.rb +0 -49
- data/ffi/neo4j/driver/internal/handlers/run_response_handler.rb +0 -32
- data/ffi/neo4j/driver/internal/handlers/session_pull_all_response_handler.rb +0 -32
- data/ffi/neo4j/driver/internal/handlers/transaction_pull_all_response_handler.rb +0 -23
- data/ffi/neo4j/driver/internal/internal_driver.rb +0 -45
- data/ffi/neo4j/driver/internal/internal_logger.rb +0 -32
- data/ffi/neo4j/driver/internal/internal_resolver.rb +0 -31
- data/ffi/neo4j/driver/internal/internal_statement_result.rb +0 -52
- data/ffi/neo4j/driver/internal/messaging/bolt_protocol.rb +0 -24
- data/ffi/neo4j/driver/internal/messaging/v1/bolt_protocol_v1.rb +0 -59
- data/ffi/neo4j/driver/internal/messaging/v2/bolt_protocol_v2.rb +0 -16
- data/ffi/neo4j/driver/internal/messaging/v3/bolt_protocol_v3.rb +0 -63
- data/ffi/neo4j/driver/internal/network_session.rb +0 -129
- data/ffi/neo4j/driver/internal/retry/exponential_backoff_retry_logic.rb +0 -80
- data/ffi/neo4j/driver/internal/session_factory_impl.rb +0 -28
- data/ffi/neo4j/driver/internal/summary/internal_result_summary.rb +0 -67
- data/ffi/neo4j/driver/internal/summary/internal_server_info.rb +0 -19
- data/ffi/neo4j/driver/internal/summary/internal_summary_counters.rb +0 -23
- data/ffi/neo4j/driver/internal/util/metadata_extractor.rb +0 -15
- data/ffi/neo4j/driver/internal/value/base_time_value.rb +0 -22
- data/ffi/neo4j/driver/internal/value/date_value.rb +0 -25
- data/ffi/neo4j/driver/internal/value/duration_value.rb +0 -27
- data/ffi/neo4j/driver/internal/value/local_date_time_value.rb +0 -24
- data/ffi/neo4j/driver/internal/value/local_time_value.rb +0 -19
- data/ffi/neo4j/driver/internal/value/node_value.rb +0 -18
- data/ffi/neo4j/driver/internal/value/offset_time_value.rb +0 -25
- data/ffi/neo4j/driver/internal/value/path_value.rb +0 -41
- data/ffi/neo4j/driver/internal/value/point2_d_value.rb +0 -24
- data/ffi/neo4j/driver/internal/value/point3_d_value.rb +0 -24
- data/ffi/neo4j/driver/internal/value/relationship_value.rb +0 -18
- data/ffi/neo4j/driver/internal/value/structure_value.rb +0 -42
- data/ffi/neo4j/driver/internal/value/time_with_zone_id_value.rb +0 -25
- data/ffi/neo4j/driver/internal/value/time_with_zone_offset_value.rb +0 -28
- data/ffi/neo4j/driver/internal/value/unbound_relationship_value.rb +0 -18
- data/ffi/neo4j/driver/internal/value/value_adapter.rb +0 -101
- data/ffi/neo4j/driver/net/server_address.rb +0 -13
- data/ffi/neo4j/driver/statement.rb +0 -15
- data/ffi/neo4j/driver/types/entity.rb +0 -21
- data/ffi/neo4j/driver/types/node.rb +0 -16
- data/ffi/neo4j/driver/types/path.rb +0 -35
- data/ffi/neo4j/driver/types/relationship.rb +0 -19
- data/ffi/neo4j/driver.rb +0 -61
- data/lib/neo4j/driver/internal/ruby_signature.rb +0 -18
@@ -0,0 +1,113 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Async
|
4
|
+
module Connection
|
5
|
+
class HandshakeHandler
|
6
|
+
def initialize(logger)
|
7
|
+
# @pipeline_builder = pipeline_builder
|
8
|
+
@log = logger
|
9
|
+
end
|
10
|
+
|
11
|
+
def handler_added(ctx)
|
12
|
+
@log = Logging::ChannelActivityLogger.new(ctx.channel, @logger, self.class)
|
13
|
+
@error_log = Logging::ChannelErrorLogger.new(ctx.channel, @logger)
|
14
|
+
end
|
15
|
+
|
16
|
+
def handler_removed0(ctx)
|
17
|
+
@failed = false
|
18
|
+
@log = nil
|
19
|
+
end
|
20
|
+
|
21
|
+
def channel_inactive(ctx)
|
22
|
+
@log.debug('Channel is inactive')
|
23
|
+
|
24
|
+
unless @failed
|
25
|
+
# channel became inactive while doing bolt handshake, not because of some previous error
|
26
|
+
error = Util::ErrorUtil.new_connection_terminated_error
|
27
|
+
fail(ctx, error)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def exception_caught(ctx, error)
|
32
|
+
if @failed
|
33
|
+
@error_log.debug('Another fatal error occurred in the pipeline', error)
|
34
|
+
else
|
35
|
+
@failed = true
|
36
|
+
cause = transform_error(error)
|
37
|
+
fail(ctx, cause)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def decode(connection)
|
42
|
+
server_suggested_version = Messaging::BoltProtocolVersion.from_raw_bytes(connection.stream.read_int)
|
43
|
+
@log.debug("S: [Bolt Handshake] #{server_suggested_version}")
|
44
|
+
# ::Logger.new(STDOUT, level: :debug).debug("S: [Bolt Handshake] #{server_suggested_version}")
|
45
|
+
|
46
|
+
protocol = protocol_for_version(server_suggested_version)
|
47
|
+
if protocol
|
48
|
+
protocol_selected(server_suggested_version, protocol, connection)
|
49
|
+
else
|
50
|
+
handle_unknown_suggested_protocol_version(server_suggested_version, connection)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def protocol_for_version(version)
|
57
|
+
Messaging::BoltProtocol.for_version(version)
|
58
|
+
rescue Neo4j::Driver::Exceptions::ClientException
|
59
|
+
nil
|
60
|
+
end
|
61
|
+
|
62
|
+
def protocol_selected(version, protocol, connection)
|
63
|
+
connection.attributes[:protocol_version] = version
|
64
|
+
connection.version = version
|
65
|
+
connection.protocol = protocol
|
66
|
+
connection.message_format = protocol.create_message_format
|
67
|
+
end
|
68
|
+
|
69
|
+
def handle_unknown_suggested_protocol_version(version, ctx)
|
70
|
+
if BoltProtocolUtil::NO_PROTOCOL_VERSION == version
|
71
|
+
fail(ctx, protocol_no_supported_by_server_error)
|
72
|
+
elsif Messaging::BoltProtocolVersion.http?(version)
|
73
|
+
fail(ctx, http_endpoint_error)
|
74
|
+
else
|
75
|
+
fail(ctx, protocol_no_supported_by_driver_error(version))
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def fail(ctx, error)
|
80
|
+
ctx.close.add_listener { @handshake_completed_promise.try_failure(error) }
|
81
|
+
end
|
82
|
+
|
83
|
+
class << self
|
84
|
+
def protocol_no_supported_by_server_error
|
85
|
+
raise Neo4j::Driver::Exception::ClientException, 'The server does not support any of the protocol versions supported by this driver. Ensure that you are using driver and server versions that are compatible with one another.'
|
86
|
+
end
|
87
|
+
|
88
|
+
def http_endpoint_error
|
89
|
+
raise Neo4j::Driver::Exception::ClientException, 'Server responded HTTP. Make sure you are not trying to connect to the http endpoint (HTTP defaults to port 7474 whereas BOLT defaults to port 7687)'
|
90
|
+
end
|
91
|
+
|
92
|
+
def protocol_no_supported_by_driver_error(suggested_protocol_version)
|
93
|
+
raise Neo4j::Driver::Exception::ClientException, "Protocol error, server suggested unexpected protocol version: #{suggested_protocol_version}"
|
94
|
+
end
|
95
|
+
|
96
|
+
def transform_error(error)
|
97
|
+
# unwrap the DecoderException if it has a cause
|
98
|
+
error = error.cause if error.is_a?(org.neo4j.driver.internal.shaded.io.netty.handler.codec.DecoderException) && error.cause
|
99
|
+
case error
|
100
|
+
when Neo4j::Driver::Exception::ServiceUnavailableException
|
101
|
+
error
|
102
|
+
when javax.net.ssl.SSLHandshakeException
|
103
|
+
Neo4j::Driver::Exception::SecurityException.new('Failed to establish secured connection with the server', error)
|
104
|
+
else
|
105
|
+
Neo4j::Driver::Exception::ServiceUnavailableException('Failed to establish connection with the server', error)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Async
|
4
|
+
module Connection
|
5
|
+
class NettyChannelInitializer #< org.neo4j.driver.internal.shaded.io.netty.channel.ChannelInitializer
|
6
|
+
def initialize(address, security_plan, connect_timeout_millis, clock, logger)
|
7
|
+
super()
|
8
|
+
@address = address
|
9
|
+
@security_plan = security_plan
|
10
|
+
@connect_timeout_millis = connect_timeout_millis
|
11
|
+
@clock = clock
|
12
|
+
@logger = logger
|
13
|
+
end
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
def initChannel(channel)
|
18
|
+
if @security_plan.requires_encryption?
|
19
|
+
ssl_handler = create_ssl_handler
|
20
|
+
channel.pipeline.add_first(ssl_handler)
|
21
|
+
end
|
22
|
+
|
23
|
+
update_channel_attributes(channel)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def create_ssl_handler
|
29
|
+
ssl_engine = create_ssl_engine
|
30
|
+
ssl_handler = org.neo4j.driver.internal.shaded.io.netty.handler.ssl.SslHandler.new(ssl_engine)
|
31
|
+
ssl_handler.set_handshake_timeout_millis(@connect_timeout_millis)
|
32
|
+
ssl_handler
|
33
|
+
end
|
34
|
+
|
35
|
+
def create_ssl_engine
|
36
|
+
ssl_context = @security_plan.ssl_context
|
37
|
+
ssl_engine = ssl_context.create_ssl_engine(@address.host, @address.port)
|
38
|
+
ssl_engine.set_use_client_mode(true)
|
39
|
+
|
40
|
+
if @security_plan.requires_hostname_verification
|
41
|
+
ssl_parameters = ssl_engine.get_ssl_parameters
|
42
|
+
ssl_parameters.set_endpoint_identification_algorithm('HTTPS')
|
43
|
+
ssl_engine.set_ssl_parameters(ssl_parameters)
|
44
|
+
end
|
45
|
+
ssl_engine
|
46
|
+
end
|
47
|
+
|
48
|
+
def update_channel_attributes(channel)
|
49
|
+
ChannelAttributes.set_server_address(channel, @address)
|
50
|
+
ChannelAttributes.set_creation_timestamp(channel, @clock.millis)
|
51
|
+
ChannelAttributes.set_message_dispatcher(channel, Inbound::InboundMessageDispatcher.new(channel, @logger))
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Async
|
4
|
+
module Connection
|
5
|
+
class NettyDomainNameResolver #< org.neo4j.driver.internal.shaded.io.netty.resolver.InetNameResolver
|
6
|
+
def initialize(executor, domain_name_resolver)
|
7
|
+
# super(executor)
|
8
|
+
@domain_name_resolver = domain_name_resolver
|
9
|
+
end
|
10
|
+
|
11
|
+
def doResolve(inet_host, promise)
|
12
|
+
promise.set_success(@domain_name_resolver.call(inet_host).first)
|
13
|
+
rescue java.net.UnknownHostException => e
|
14
|
+
promise.set_failure(e)
|
15
|
+
end
|
16
|
+
|
17
|
+
def doResolveAll(inet_host, promise)
|
18
|
+
promise.set_success(@domain_name_resolver.call(inet_host))
|
19
|
+
rescue java.net.UnknownHostException => e
|
20
|
+
promise.set_failure(e)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Async
|
4
|
+
module Connection
|
5
|
+
class NettyDomainNameResolverGroup #< org.neo4j.driver.internal.shaded.io.netty.resolver.AddressResolverGroup
|
6
|
+
attr_reader :domain_name_resolver
|
7
|
+
|
8
|
+
def initialize(&domain_name_resolver)
|
9
|
+
@domain_name_resolver = domain_name_resolver
|
10
|
+
end
|
11
|
+
|
12
|
+
def newResolver(executor)
|
13
|
+
NettyDomainNameResolver.new(executor, domain_name_resolver).as_address_resolver
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Async
|
4
|
+
module Connection
|
5
|
+
# A connection used by the routing driver.
|
6
|
+
class RoutingConnection < Struct.new(:delegate, :database_name, :access_mode, :impersonated_user, :error_handler)
|
7
|
+
delegate *%i[enable_auto_read disable_auto_read reset open? release terminate_and_release server_agent
|
8
|
+
server_address server_version protocol flush], to: :delegate
|
9
|
+
alias mode access_mode
|
10
|
+
|
11
|
+
def write(message1, handler1, message2 = nil, handler2 = nil)
|
12
|
+
if message2.present? && handler2.present?
|
13
|
+
delegate.write(message1, handler1, message2, handler2)
|
14
|
+
else
|
15
|
+
delegate.write(message1, handler1)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def write_and_flush(message1, handler1, message2 = nil, handler2 = nil)
|
20
|
+
if message2.present? && handler2.present?
|
21
|
+
delegate.write_and_flush(message1, handler1, message2, handler2)
|
22
|
+
else
|
23
|
+
delegate.write_and_flush(message1, handler1)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def new_routing_response_handler(handler)
|
30
|
+
Handlers::RoutingResponseHandler.new(handler, server_address, access_mode, error_handler)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Async
|
4
|
+
module Connection
|
5
|
+
class StreamReader
|
6
|
+
include Inbound::ChunkDecoder
|
7
|
+
include Packstream::PackInput
|
8
|
+
include Packstream::PackStream::Unpacker
|
9
|
+
include Messaging::Common::CommonValueUnpacker
|
10
|
+
# delegate_missing_to :@input
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Async
|
4
|
+
class ImmutableConnectionContext
|
5
|
+
attr :database_name, :mode, :rediscovery_bookmark, :impersonated_user
|
6
|
+
|
7
|
+
def initialize(database_name, bookmark, mode)
|
8
|
+
@database_name = database_name
|
9
|
+
@rediscovery_bookmark = bookmark
|
10
|
+
@mode = mode
|
11
|
+
end
|
12
|
+
|
13
|
+
SINGLE_DB_CONTEXT = new(DatabaseNameUtil::DEFAULT_DATABASE, InternalBookmark::EMPTY, AccessMode::READ)
|
14
|
+
MULTI_DB_CONTEXT = new(DatabaseNameUtil::SYSTEM_DATABASE, InternalBookmark::EMPTY, AccessMode::READ)
|
15
|
+
|
16
|
+
# A simple context is used to test connectivity with a remote server/cluster. As long as there is a read only service, the connection shall be established
|
17
|
+
# successfully. Depending on whether multidb is supported or not, this method returns different context for routing table discovery.
|
18
|
+
def self.simple(supports_multi_db)
|
19
|
+
supports_multi_db ? MULTI_DB_CONTEXT : SINGLE_DB_CONTEXT
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Async
|
4
|
+
module Inbound
|
5
|
+
class ByteBufInput
|
6
|
+
delegate :read_byte, :read_short, :read_int, :read_long, :read_double, :read_bytes, to: :@buf
|
7
|
+
|
8
|
+
def start(new_buf)
|
9
|
+
assert_not_started
|
10
|
+
@buf = Validator.require_non_nil!(new_buf)
|
11
|
+
end
|
12
|
+
|
13
|
+
def stop
|
14
|
+
@buf = nil
|
15
|
+
end
|
16
|
+
|
17
|
+
def peek_byte
|
18
|
+
@buf.get_byte(@buf.read_index)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def assert_not_started
|
24
|
+
raise Neo4j::Driver::Exceptions::IllegalStateException, 'Already started' if @buf
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Async
|
4
|
+
module Inbound
|
5
|
+
class ChannelErrorHandler
|
6
|
+
def initialize(logger)
|
7
|
+
@logger = logger
|
8
|
+
end
|
9
|
+
|
10
|
+
def handler_added(ctx)
|
11
|
+
@message_dispatcher = java.util.Objects.require_non_null(Connection::ChannelAttributes.message_dispatcher(ctx.channel))
|
12
|
+
@log = Logging::ChannelActivityLogger.new(ctx.channel, @logger, self.class)
|
13
|
+
@error_log = Logging::ChannelErrorLogger.new(ctx.channel, @logger)
|
14
|
+
end
|
15
|
+
|
16
|
+
def handler_removed(ctx)
|
17
|
+
@message_dispatcher = @log = nil
|
18
|
+
@failed = false
|
19
|
+
end
|
20
|
+
|
21
|
+
def channel_inactive(ctx)
|
22
|
+
@log.debug('Channel is inactive')
|
23
|
+
|
24
|
+
termination_reason = Connection::ChannelAttributes.termination_reason(ctx.channel)
|
25
|
+
error = Util::ErrorUtil.new_connection_terminated_error(termination_reason)
|
26
|
+
|
27
|
+
if @failed
|
28
|
+
|
29
|
+
# channel became inactive not because of a fatal exception that came from exceptionCaught
|
30
|
+
# it is most likely inactive because actual network connection broke or was explicitly closed by the driver
|
31
|
+
@message_dispatcher.handle_channel_inactive(error)
|
32
|
+
ctx.channel.close
|
33
|
+
else
|
34
|
+
fail(error)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def exception_caught(ctx, error)
|
39
|
+
if @failed
|
40
|
+
@error_log.trace_or_debug('Another fatal error occurred in the pipeline', error)
|
41
|
+
else
|
42
|
+
@failed = true
|
43
|
+
log_unexpected_error_warning(error)
|
44
|
+
fail(error)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def log_unexpected_error_warning(error)
|
51
|
+
unless error.is_a?(Exceptions::ConnectionReadTimeoutException)
|
52
|
+
@error_log.trace_or_debug('Fatal error occurred in the pipeline', error)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def fail(error)
|
57
|
+
cause = transform_error(error)
|
58
|
+
@message_dispatcher.handle_channel_error(cause)
|
59
|
+
end
|
60
|
+
|
61
|
+
class << self
|
62
|
+
def transform_error(error)
|
63
|
+
# unwrap the CodecException if it has a cause
|
64
|
+
error = error.cause if error.is_a?(io.netty.handler.codec.CodecException) && error.cause
|
65
|
+
|
66
|
+
if error.is_a?(java.io.IOException)
|
67
|
+
Neo4j::Driver::Exceptions::ServiceUnavailableException.new('Connection to the database failed', error)
|
68
|
+
else
|
69
|
+
error
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Async
|
4
|
+
module Inbound
|
5
|
+
module ChunkDecoder
|
6
|
+
def initialize(input)
|
7
|
+
@input = input
|
8
|
+
@remaining = 0
|
9
|
+
end
|
10
|
+
|
11
|
+
def read_exactly(size, buffer = nil)
|
12
|
+
while @remaining.zero?
|
13
|
+
@remaining = read_length_field
|
14
|
+
end
|
15
|
+
if size > @remaining
|
16
|
+
# (buffer ||= Buffer.new(capacity: size)) << super(@remaining)
|
17
|
+
(buffer ||= ::Async::IO::Buffer.new) << @input.read_exactly(@remaining)
|
18
|
+
size -= @remaining
|
19
|
+
@remaining = 0
|
20
|
+
read_exactly(size, buffer)
|
21
|
+
else
|
22
|
+
data = @input.read_exactly(size)
|
23
|
+
@remaining -= size
|
24
|
+
buffer ? buffer << data : data
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def ensure_termination
|
29
|
+
raise 'Chunking problem' unless @remaining.zero? && read_length_field.zero?
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def read_length_field
|
35
|
+
@input.read_exactly(2).unpack1('S>')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Async
|
4
|
+
module Inbound
|
5
|
+
# Handler needed to limit amount of time connection performs TLS and Bolt handshakes.
|
6
|
+
# It should only be used when connection is established and removed from the pipeline afterwards.
|
7
|
+
# Otherwise it will make long running queries fail.
|
8
|
+
class ConnectTimeoutHandler #< org.neo4j.driver.internal.shaded.io.netty.handler.timeout.ReadTimeoutHandler
|
9
|
+
def initialize(timeout_millis)
|
10
|
+
super(timeout_millis, java.util.concurrent.TimeUnit::MILLISECONDS)
|
11
|
+
@timeout_millis = timeout_millis
|
12
|
+
end
|
13
|
+
|
14
|
+
protected
|
15
|
+
|
16
|
+
def readTimedOut(ctx)
|
17
|
+
unless @triggered
|
18
|
+
@triggered = true
|
19
|
+
ctx.fire_exception_caught(unable_to_connect_error)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def unable_to_connect_error
|
26
|
+
Neo4j::Driver::Exceptions::ServiceUnavailableException.new("Unable to establish connection in #{@timeout_millis}ms")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Async
|
4
|
+
module Inbound
|
5
|
+
class ConnectionReadTimeoutHandler #< org.neo4j.driver.internal.shaded.io.netty.handler.timeout.ReadTimeoutHandler
|
6
|
+
def read_timeout(ctx)
|
7
|
+
unless @triggered
|
8
|
+
ctx.fire_exception_caught(Neo4j::Driver::Exception::ConnectionReadTimeoutException::INSTANCE)
|
9
|
+
ctx.close
|
10
|
+
@triggered = true
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|