neo4j-ruby-driver 1.7.4 → 4.4.0.alpha.1
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 +2 -1
- 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/driver/version.rb +1 -1
- 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 +32 -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 +33 -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 +39 -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 +30 -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/ruby/neo4j/driver.rb +30 -0
- metadata +277 -102
- 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 -125
- 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,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j::Driver::Internal
|
4
|
+
class SecuritySetting
|
5
|
+
include Scheme
|
6
|
+
|
7
|
+
attr_reader :encrypted, :trust_strategy, :customized
|
8
|
+
|
9
|
+
def initialize(encrypted, trust_strategy, customized)
|
10
|
+
@encrypted = encrypted
|
11
|
+
@trust_strategy = trust_strategy
|
12
|
+
@customized = customized
|
13
|
+
end
|
14
|
+
|
15
|
+
def create_security_plan(uri_scheme)
|
16
|
+
validate_scheme!(uri_scheme)
|
17
|
+
begin
|
18
|
+
if security_scheme?(uri_scheme)
|
19
|
+
assert_security_settings_not_user_configured(uri_scheme)
|
20
|
+
create_security_plan_from_scheme(uri_scheme)
|
21
|
+
else
|
22
|
+
create_security_plan_impl(encrypted, trust_strategy)
|
23
|
+
end
|
24
|
+
# rescue java.security.GeneralSecurityException, IOError
|
25
|
+
rescue IOError
|
26
|
+
raise Neo4j::Driver::Exceptions::ClientException, 'Unable to establish SSL parameters'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def create_security_plan_from_scheme(uri_scheme)
|
31
|
+
if high_trust_scheme?(uri_scheme)
|
32
|
+
org.neo4j.driver.internal.security.SecurityPlanImpl.forSystemCASignedCertificates(
|
33
|
+
true, org.neo4j.driver.internal.RevocationStrategy::NO_CHECKS
|
34
|
+
)
|
35
|
+
else
|
36
|
+
org.neo4j.driver.internal.security.SecurityPlanImpl.forAllCertificates(false, org.neo4j.driver.internal.RevocationStrategy::NO_CHECKS)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def assert_security_settings_not_user_configured(uri_scheme)
|
43
|
+
return unless customized
|
44
|
+
|
45
|
+
raise Neo4j::Driver::Exceptions::ClientException,
|
46
|
+
"Scheme #{uri_scheme} is not configurable with manual encryption and trust settings"
|
47
|
+
end
|
48
|
+
|
49
|
+
def create_security_plan_impl(encrypted, trust_strategy)
|
50
|
+
return Security::SecurityPlanImpl.insecure unless encrypted
|
51
|
+
|
52
|
+
hostname_verification_enabled = trust_strategy.hostname_verification_enabled?
|
53
|
+
revocation_strategy = trust_strategy.revocation_strategy
|
54
|
+
|
55
|
+
case trust_strategy.strategy
|
56
|
+
when Config::TrustStrategy::TRUST_CUSTOM_CA_SIGNED_CERTIFICATES
|
57
|
+
return Security::SecurityPlanImpl.forCustomCASignedCertificates(
|
58
|
+
trust_strategy.cert_file_to_java, hostname_verification_enabled, revocation_strategy
|
59
|
+
)
|
60
|
+
when Config::TrustStrategy::TRUST_SYSTEM_CA_SIGNED_CERTIFICATES
|
61
|
+
return Security::SecurityPlanImpl.forSystemCASignedCertificates(
|
62
|
+
hostname_verification_enabled, revocation_strategy
|
63
|
+
)
|
64
|
+
when Config::TrustStrategy::TRUST_ALL_CERTIFICATES
|
65
|
+
return Security::SecurityPlanImpl.forAllCertificates(
|
66
|
+
hostname_verification_enabled, revocation_strategy
|
67
|
+
)
|
68
|
+
else
|
69
|
+
raise ClientException, "Unknown TLS authentication strategy: #{trust_strategy.strategy}"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
class SessionFactoryImpl
|
4
|
+
attr_reader :connection_provider
|
5
|
+
delegate :verify_connectivity, :close, :supports_multi_db?, to: :connection_provider
|
6
|
+
|
7
|
+
def initialize(connection_provider, retry_logic, config)
|
8
|
+
@connection_provider = connection_provider
|
9
|
+
@leaked_sessions_logging_enabled = config[:leaked_session_logging]
|
10
|
+
@retry_logic = retry_logic
|
11
|
+
@logger = config[:logger]
|
12
|
+
@default_fetch_size = config[:fetch_size]
|
13
|
+
end
|
14
|
+
|
15
|
+
def new_instance(fetch_size: @default_fetch_size, default_access_mode: AccessMode::WRITE, **config)
|
16
|
+
bookmark_holder = DefaultBookmarkHolder.new(InternalBookmark.from(*config[:bookmarks]))
|
17
|
+
create_session(parse_database_name(config), default_access_mode, bookmark_holder, fetch_size, config[:impersonated_user])
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def parse_database_name(config)
|
23
|
+
config[:database]&.then(&DatabaseNameUtil.method(:database)) || DatabaseNameUtil.default_database
|
24
|
+
end
|
25
|
+
|
26
|
+
def create_session(database_name, mode, bookmark_holder, fetch_size, impersonated_user)
|
27
|
+
(@leaked_sessions_logging_enabled ? org.neo4j.driver.internal.async.LeakLoggingNetworkSession : Async::NetworkSession)
|
28
|
+
.new(@connection_provider, @retry_logic, database_name, mode, bookmark_holder, impersonated_user, fetch_size, @logger)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Spi
|
4
|
+
module Connection
|
5
|
+
def mode
|
6
|
+
raise java.lang.UnsupportedOperationException, "#{self.class} does not support access mode."
|
7
|
+
end
|
8
|
+
|
9
|
+
def database_name
|
10
|
+
raise java.lang.UnsupportedOperationException, "#{self.class} does not support database name."
|
11
|
+
end
|
12
|
+
|
13
|
+
def impersonated_user
|
14
|
+
raise java.lang.UnsupportedOperationException, "#{self.class} does not support impersonated user."
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Spi
|
4
|
+
module ResponseHandler
|
5
|
+
# Tells whether this response handler is able to manage auto-read of the underlying connection using {@link Connection#enableAutoRead()} and
|
6
|
+
# {@link Connection#disableAutoRead()}.
|
7
|
+
# <p>
|
8
|
+
# Implementations can use auto-read management to apply network-level backpressure when receiving a stream of records.
|
9
|
+
# There should only be a single such handler active for a connection at one point in time. Otherwise, handlers can interfere and turn on/off auto-read
|
10
|
+
# racing with each other. {@link InboundMessageDispatcher} is responsible for tracking these handlers and disabling auto-read management to maintain just
|
11
|
+
# a single auto-read managing handler per connection.
|
12
|
+
def can_manage_auto_read?
|
13
|
+
false
|
14
|
+
end
|
15
|
+
|
16
|
+
# If this response handler is able to manage auto-read of the underlying connection, then this method signals it to
|
17
|
+
# stop changing auto-read setting for the connection.
|
18
|
+
def disable_auto_read_management
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j::Driver::Internal::Summary
|
4
|
+
# Creating a position from and offset, line number and a column number.
|
5
|
+
#
|
6
|
+
# @param offset the offset from the start of the string, starting from 0.
|
7
|
+
# @param line the line number, starting from 1.
|
8
|
+
# @param column the column number, starting from 1.
|
9
|
+
class InternalInputPosition < Struct.new(:offset, :line, :column)
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j::Driver::Internal::Summary
|
4
|
+
class InternalNotification < Struct.new(:code, :title, :description, :severity, :position)
|
5
|
+
|
6
|
+
VALUE_TO_NOTIFICATION = lambda do |value|
|
7
|
+
severity = value[:severity] || 'N/A'
|
8
|
+
|
9
|
+
position = value[:position]&.then do |pos_value|
|
10
|
+
InternalInputPosition.new(*pos_value.values_at(:offset, :line, :column).map(&:to_i))
|
11
|
+
end
|
12
|
+
|
13
|
+
InternalNotification.new(*value.values_at(:code, :title, :description), severity, position)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j::Driver::Internal::Summary
|
4
|
+
# Only call #initialize when sub-classing, for constructing plans, use .plan instead
|
5
|
+
class InternalPlan < Struct.new(:operator_type, :arguments, :identifiers, :children)
|
6
|
+
# Since a plan with or without profiling looks almost the same, we just keep two impls. of this
|
7
|
+
# around to contain the small difference, and share the rest of the code for building plan trees.
|
8
|
+
# @param <T>
|
9
|
+
|
10
|
+
class Converter
|
11
|
+
def initialize(&plan_creator)
|
12
|
+
@plan_creator = plan_creator
|
13
|
+
end
|
14
|
+
|
15
|
+
def apply(plan)
|
16
|
+
operator_type = plan[:operatorType]
|
17
|
+
|
18
|
+
arguments_value = plan[:args]
|
19
|
+
arguments = arguments_value || {}
|
20
|
+
|
21
|
+
identifiers_value = plan[:identifiers]
|
22
|
+
identifiers = identifiers_value || []
|
23
|
+
|
24
|
+
children_value = plan[:children]
|
25
|
+
children = children_value || []
|
26
|
+
|
27
|
+
@plan_creator.call(operator_type, arguments, identifiers, children, plan)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
EXPLAIN_PLAN = lambda { |operator_type, arguments, identifiers, children, _original_plan_value|
|
32
|
+
new(operator_type, arguments, identifiers, children) }
|
33
|
+
|
34
|
+
# Builds a regular plan without profiling information - eg. a plan that came as a result of an `EXPLAIN` query
|
35
|
+
EXPLAIN_PLAN_FROM_VALUE = Converter.new(&EXPLAIN_PLAN).method(:apply)
|
36
|
+
|
37
|
+
def self.plan(operator_type, arguments, identifiers, children)
|
38
|
+
EXPLAIN_PLAN.call(operator_type, arguments, identifiers, children, nil)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j::Driver::Internal::Summary
|
4
|
+
class InternalProfiledPlan < InternalPlan
|
5
|
+
attr_reader :db_hits, :records, :page_cache_hits, :page_cache_misses, :page_cache_hit_ratio, :time
|
6
|
+
|
7
|
+
PROFILED_PLAN = lambda { |operator_type, arguments, identifiers, children, original_plan_value|
|
8
|
+
new(
|
9
|
+
operator_type, arguments, identifiers, children, original_plan_value[:db_hits].to_i,
|
10
|
+
original_plan_value[:rows].to_i, original_plan_value[:page_cache_hits].to_i,
|
11
|
+
original_plan_value[:page_cache_misses].to_i, original_plan_value[:page_cache_hit_ratio].to_f,
|
12
|
+
original_plan_value[:time].to_i
|
13
|
+
) }
|
14
|
+
|
15
|
+
# Builds a regular plan without profiling information - eg. a plan that came as a result of an `EXPLAIN` query
|
16
|
+
PROFILED_PLAN_FROM_VALUE = Converter.new(&PROFILED_PLAN).method(:apply)
|
17
|
+
|
18
|
+
def initialize(operator_type, arguments, identifiers, children, db_hits, records, page_cache_hits, page_cache_misses, page_cache_hit_ratio, time)
|
19
|
+
super(operator_type, arguments, identifiers, children)
|
20
|
+
@db_hits = db_hits
|
21
|
+
@records = records
|
22
|
+
@page_cache_hits = page_cache_hits
|
23
|
+
@page_cache_misses = page_cache_misses
|
24
|
+
@page_cache_hit_ratio = page_cache_hit_ratio
|
25
|
+
@time = time
|
26
|
+
end
|
27
|
+
|
28
|
+
def page_cache_stats?
|
29
|
+
page_cache_hits.positive? || page_cache_misses.positive? || page_cache_hit_ratio.positive?
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j::Driver::Internal::Summary
|
4
|
+
class InternalResultSummary < Struct.new(:query, :server, :database, :query_type, :counters, :plan, :profile,
|
5
|
+
:notifications, :result_available_after, :result_consumed_after)
|
6
|
+
alias has_plan? plan
|
7
|
+
alias has_profile? profile
|
8
|
+
|
9
|
+
def initialize(*args)
|
10
|
+
super
|
11
|
+
self.plan = resolve_plan(plan, profile)
|
12
|
+
end
|
13
|
+
|
14
|
+
def counters
|
15
|
+
super || InternalSummaryCounters::EMPTY_STATS
|
16
|
+
end
|
17
|
+
|
18
|
+
def notifications
|
19
|
+
super || []
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
# Profiled plan is a superset of plan. This method returns profiled plan if plan is {@code null}.
|
25
|
+
#
|
26
|
+
# @param plan the given plan, possibly {@code null}.
|
27
|
+
# @param profiled_plan the given profiled plan, possibly {@code null}.
|
28
|
+
# @return available plan.
|
29
|
+
def resolve_plan(plan, profiled_plan)
|
30
|
+
plan || profiled_plan
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j::Driver::Internal::Summary
|
4
|
+
class InternalSummaryCounters < Struct.new(:nodes_created, :nodes_deleted, :relationships_created,
|
5
|
+
:relationships_deleted, :properties_set, :labels_added, :labels_removed,
|
6
|
+
:indexes_added, :indexes_removed, :constraints_added, :constraints_removed,
|
7
|
+
:system_updates)
|
8
|
+
EMPTY_STATS = InternalSummaryCounters.new(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
9
|
+
|
10
|
+
def contains_updates?
|
11
|
+
any?(&:positive?)
|
12
|
+
end
|
13
|
+
|
14
|
+
def contains_system_updates?
|
15
|
+
system_updates.positive?
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,196 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Svm
|
4
|
+
# This substitution avoid having loggers added to the build
|
5
|
+
class Target_io_netty_util_internal_logging_InternalLoggerFactory
|
6
|
+
def self.new_default_factory(name)
|
7
|
+
org.neo4j.driver.internal.shaded.io.netty.util.internal.logging.JdkLoggerFactory::INSTANCE
|
8
|
+
end
|
9
|
+
end
|
10
|
+
# SSL
|
11
|
+
# This whole section is mostly about removing static analysis references to openssl/tcnative
|
12
|
+
class Target_io_netty_handler_ssl_JdkSslServerContext
|
13
|
+
def initialize(provider, trust_cert_collection, trust_manager_factory, key_cert_chain, key, key_password,
|
14
|
+
key_manager_factory, ciphers, cipher_filter, apn, session_cache_size, session_timeout, client_auth,
|
15
|
+
protocols, start_tls, key_store)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class Target_io_netty_handler_ssl_JdkSslClientContext
|
20
|
+
def initialize(ssl_context_provider, trust_cert_collection, trust_manager_factory, key_cert_chain, key, key_password,
|
21
|
+
key_manager_factory, ciphers, cipher_filter, apn, protocols, session_cache_size, session_timeout,
|
22
|
+
key_store_type)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class Target_io_netty_handler_ssl_SslHandler
|
27
|
+
JDK = nil
|
28
|
+
def for_engine
|
29
|
+
JDK
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class Target_io_netty_handler_ssl_JdkAlpnApplicationProtocolNegotiator_AlpnWrapper
|
34
|
+
def wrap_ssl_engine(engine, alloc, application_negotiator, server)
|
35
|
+
Target_io_netty_handler_ssl_JdkAlpnSslEngine.new(engine, application_negotiator, server)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def Target_io_netty_handler_ssl_JdkAlpnApplicationProtocolNegotiator_AlpnWrapperJava8
|
40
|
+
def wrap_ssl_engine(engine, alloc, application_negotiator, server)
|
41
|
+
if Target_io_netty_handler_ssl_JettyAlpnSslEngine.available?
|
42
|
+
return server ? Target_io_netty_handler_ssl_JettyAlpnSslEngine.new_server_engine(engine, application_negotiator) : Target_io_netty_handler_ssl_JettyAlpnSslEngine.new_client_engine(engine, application_negotiator)
|
43
|
+
end
|
44
|
+
|
45
|
+
raise RuntimeError, "Unable to wrap SSLEngine of type #{engine.class.name}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class Target_io_netty_handler_ssl_JettyAlpnSslEngine
|
50
|
+
def self.available?
|
51
|
+
false
|
52
|
+
end
|
53
|
+
|
54
|
+
def new_client_engine(engine, application_negotiator)
|
55
|
+
nil
|
56
|
+
end
|
57
|
+
|
58
|
+
def new_server_engine(engine, application_negotiator)
|
59
|
+
nil
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
class Target_io_netty_handler_ssl_JdkAlpnSslEngine
|
64
|
+
def initialize(engine, application_negotiator, server)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
class Target_io_netty_handler_ssl_SslContext
|
69
|
+
def new_client_context_internal(provider, ssl_context_provider, trust_cert_collection, trust_manager_factory, key_cert_chain, key, key_password,
|
70
|
+
key_manager_factory, ciphers, cipher_filter, apn, session_cache_size, session_timeout, client_auth,
|
71
|
+
protocols, start_tls, enable_ocsp, key_store_type, ctx_options)
|
72
|
+
|
73
|
+
if enable_ocsp
|
74
|
+
raise ArgumentError, "OCSP is not supported with this SslProvider: #{provider}"
|
75
|
+
else
|
76
|
+
Target_io_netty_handler_ssl_JdkSslServerContext.new(ssl_context_provider, trust_cert_collection, trust_manager_factory, key_cert_chain, key, key_password,
|
77
|
+
key_manager_factory, ciphers, cipher_filter, apn, session_cache_size, session_timeout, client_auth,
|
78
|
+
protocols, start_tls, key_store_type)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def new_client_context_internal(provider, ssl_context_provider, trust_cert, trust_manager_factory, key_cert_chain,
|
83
|
+
key, key_password, key_manager_factory, ciphers, cipher_filter, apn, protocols,
|
84
|
+
session_cache_size, session_timeout, enable_ocsp, key_store_type, options)
|
85
|
+
|
86
|
+
if enable_ocsp
|
87
|
+
raise ArgumentError, "OCSP is not supported with this SslProvider: #{provider}"
|
88
|
+
else
|
89
|
+
Target_io_netty_handler_ssl_JdkSslClientContext.new(ssl_context_provider, trust_cert, trust_manager_factory, key_cert_chain, key, key_password,
|
90
|
+
key_manager_factory, ciphers, cipher_filter, apn, protocols, session_cache_size, session_timeout, key_store_type)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
class Target_io_netty_handler_ssl_JdkDefaultApplicationProtocolNegotiator
|
96
|
+
INSTANCE = :instance
|
97
|
+
end
|
98
|
+
|
99
|
+
class Target_io_netty_handler_ssl_JdkSslContext
|
100
|
+
def self.to_negotiator(config, server)
|
101
|
+
if config.nil?
|
102
|
+
return Target_io_netty_handler_ssl_JdkDefaultApplicationProtocolNegotiator::INSTANCE
|
103
|
+
end
|
104
|
+
|
105
|
+
case config.protocol
|
106
|
+
when NONE
|
107
|
+
Target_io_netty_handler_ssl_JdkDefaultApplicationProtocolNegotiator::INSTANCE
|
108
|
+
when ALPN
|
109
|
+
if server
|
110
|
+
# GRAAL RC9 bug: https://github.com/oracle/graal/issues/813
|
111
|
+
# switch(config.selectorFailureBehavior()) {
|
112
|
+
# case FATAL_ALERT:
|
113
|
+
# return new JdkAlpnApplicationProtocolNegotiator(true, config.supportedProtocols());
|
114
|
+
# case NO_ADVERTISE:
|
115
|
+
# return new JdkAlpnApplicationProtocolNegotiator(false, config.supportedProtocols());
|
116
|
+
# default:
|
117
|
+
# throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ")
|
118
|
+
# . append(config.selectorFailureBehavior()).append(" failure behavior").toString());
|
119
|
+
# }
|
120
|
+
behavior = config.selector_failure_behavior
|
121
|
+
if behavior == org.neo4j.driver.internal.shaded.io.netty.handler.ssl.ApplicationProtocolConfig.SelectorFailureBehavior::FATAL_ALERT
|
122
|
+
return org.neo4j.driver.internal.shaded.io.netty.handler.ssl.JdkAlpnApplicationProtocolNegotiator.new(true, config.supported_protocols)
|
123
|
+
elsif org.neo4j.driver.internal.shaded.io.netty.handler.ssl.ApplicationProtocolConfig.SelectorFailureBehavior::NO_ADVERTISE
|
124
|
+
return org.neo4j.driver.internal.shaded.io.netty.handler.ssl.JdkAlpnApplicationProtocolNegotiator.new(false, config.supported_protocols)
|
125
|
+
else
|
126
|
+
raise UnsupportedOperationException, "JDK provider does not support #{config.selector_failure_behavior} failure behavior"
|
127
|
+
end
|
128
|
+
else
|
129
|
+
case config.selected_listener_failure_behavior
|
130
|
+
when ACCEPT
|
131
|
+
org.neo4j.driver.internal.shaded.io.netty.handler.ssl.JdkAlpnApplicationProtocolNegotiator.new(false, config.supported_protocols)
|
132
|
+
when FATAL_ALERT
|
133
|
+
return org.neo4j.driver.internal.shaded.io.netty.handler.ssl.JdkAlpnApplicationProtocolNegotiator.new(true, config.supported_protocols)
|
134
|
+
else
|
135
|
+
raise UnsupportedOperationException, "JDK provider does not support #{config.selected_listener_failure_behavior} failure behavior"
|
136
|
+
end
|
137
|
+
end
|
138
|
+
else
|
139
|
+
raise UnsupportedOperationException, "JDK provider does not support #{config.protocol} protocol"
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
# This one only prints exceptions otherwise we get a useless bogus
|
145
|
+
# exception message: https://github.com/eclipse-vertx/vert.x/issues/1657
|
146
|
+
class Target_io_netty_bootstrap_AbstractBootstrap
|
147
|
+
def initialize(channel)
|
148
|
+
@channel_factory = org.neo4j.driver.internal.shaded.io.netty.bootstrap.ChannelFactory.new
|
149
|
+
end
|
150
|
+
|
151
|
+
def config
|
152
|
+
nil
|
153
|
+
end
|
154
|
+
|
155
|
+
def init_and_register
|
156
|
+
begin
|
157
|
+
channel = @channel_factory.new_channel
|
158
|
+
new(channel)
|
159
|
+
rescue StandardError => e
|
160
|
+
# THE FIX IS HERE:
|
161
|
+
t.print_stack_trace
|
162
|
+
unless channel.nil?
|
163
|
+
# channel can be null if newChannel crashed (eg SocketException("too many open files"))
|
164
|
+
channel.unsafe.close_forcibly
|
165
|
+
end
|
166
|
+
|
167
|
+
# as the Channel is not registered yet we need to force the usage of the GlobalEventExecutor
|
168
|
+
org.neo4j.driver.internal.shaded.io.netty.channel.DefaultChannelPromise.new(channel, io.netty.util.concurrent.GlobalEventExecutor::INSTANCE).set_failure(e)
|
169
|
+
end
|
170
|
+
|
171
|
+
reg_future = config.group.register(channel)
|
172
|
+
if reg_future.cause
|
173
|
+
if channel.registered?
|
174
|
+
channel.close
|
175
|
+
else
|
176
|
+
channel.unsafe.close_forcibly
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
# If we are here and the promise is not failed, it's one of the following cases:
|
181
|
+
# 1) If we attempted registration from the event loop, the registration has been completed at this point.
|
182
|
+
# i.e. It's safe to attempt bind() or connect() now because the channel has been registered.
|
183
|
+
# 2) If we attempted registration from the other thread, the registration request has been successfully
|
184
|
+
# added to the event loop's task queue for later execution.
|
185
|
+
# i.e. It's safe to attempt bind() or connect() now:
|
186
|
+
# because bind() or connect() will be executed *after* the scheduled registration task is executed
|
187
|
+
# because register(), bind(), and connect() are all bound to the same thread.
|
188
|
+
reg_future
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
class NettySubstitutions
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Svm
|
4
|
+
# This substitution avoid having jcraft zlib added to the build
|
5
|
+
class Target_org_neo4j_driver_internal_shaded_io_netty_handler_codec_compression_ZlibCodecFactory
|
6
|
+
class << self
|
7
|
+
def new_zlib_encoder(wrapper, compression_level)
|
8
|
+
org.neo4j.driver.internal.shaded.io.netty.handler.codec.compression.JdkZlibEncoder.new(wrapper, compression_level)
|
9
|
+
end
|
10
|
+
|
11
|
+
def zlib_decoder(wrapper)
|
12
|
+
org.neo4j.driver.internal.shaded.io.netty.handler.codec.compression.jdk_zlib_decoder(wrapper)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class ZLibSubstitutions
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Util
|
4
|
+
|
5
|
+
# A tool used to save, load certs, etc.
|
6
|
+
class CertificateTool
|
7
|
+
BEGIN_CERT = "-----BEGIN CERTIFICATE-----"
|
8
|
+
END_CERT = "-----END CERTIFICATE-----"
|
9
|
+
|
10
|
+
# Save a certificate to a file in base 64 binary format with BEGIN and END strings
|
11
|
+
# @param certStr
|
12
|
+
# @param certFile
|
13
|
+
# @throws IOException
|
14
|
+
class << self
|
15
|
+
def save_x509_cert(cert_str, cert_file)
|
16
|
+
writer = java.io.BufferedWriter.new(java.io.FileWriter.new(cert_file))
|
17
|
+
|
18
|
+
writer.write(BEGIN_CERT)
|
19
|
+
writer.new_line
|
20
|
+
|
21
|
+
writer.write(cert_str)
|
22
|
+
writer.new_line
|
23
|
+
|
24
|
+
writer.write(END_CERT)
|
25
|
+
writer.new_line
|
26
|
+
end
|
27
|
+
|
28
|
+
# Save a certificate to a file. Remove all the content in the file if there is any before.
|
29
|
+
|
30
|
+
# @param cert
|
31
|
+
# @param certFile
|
32
|
+
# @throws GeneralSecurityException
|
33
|
+
# @throws IOException
|
34
|
+
|
35
|
+
# Load the certificates written in X.509 format in a file to a key store.
|
36
|
+
|
37
|
+
# @param certFile
|
38
|
+
# @param keyStore
|
39
|
+
# @throws GeneralSecurityException
|
40
|
+
# @throws IOException
|
41
|
+
def load_x509_cert(cert_file, key_store)
|
42
|
+
input_stream = java.io.BufferedInputStream.new(java.io.FileInputStream.new(cert_file))
|
43
|
+
|
44
|
+
cert_factory = java.security.cert.CertificateFactory.get_instance('X.509')
|
45
|
+
cert_count = 0 #The file might contain multiple certs
|
46
|
+
|
47
|
+
while input_stream.available > 0
|
48
|
+
begin
|
49
|
+
cert = cert_factory.generate_certificate(input_stream)
|
50
|
+
cert_count = cert_count + 1
|
51
|
+
# load_x509_cert(cert, 'neo4j.javadriver.trustedcert.', cert_count, key_store)
|
52
|
+
rescue java.security.cert.CertificateException => e
|
53
|
+
|
54
|
+
# This happens if there is whitespace at the end of the certificate - we load one cert, and then try and load a
|
55
|
+
# second cert, at which point we fail
|
56
|
+
return if !e.get_cause.nil? && e.get_cause.get_message == 'Empty input'
|
57
|
+
raise java.io.IOException.new("Failed to load certificate from `#{cert_file.get_absolute_path}`: #{cert_count} : #{e.get_message}", e)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Util
|
4
|
+
module Clock
|
5
|
+
module System
|
6
|
+
class << self
|
7
|
+
def millis()
|
8
|
+
gettime(:millisecond)
|
9
|
+
end
|
10
|
+
|
11
|
+
def time()
|
12
|
+
gettime(:float_second).seconds
|
13
|
+
end
|
14
|
+
|
15
|
+
def sleep(duration)
|
16
|
+
super(duration.in_seconds)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def gettime(unit)
|
22
|
+
Process.clock_gettime(Process::CLOCK_MONOTONIC, unit)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|