neo4j-ruby-driver 1.7.6 → 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 -11
- 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 +266 -91
- 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,104 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j::Driver::Internal::Util
|
4
|
+
class ErrorUtil
|
5
|
+
DEFAULT_CONN_TERMINATED_REASON = 'Please ensure that your database is listening on the correct host and port and '\
|
6
|
+
'that you have compatible encryption settings both on Neo4j server and driver. '\
|
7
|
+
'Note that the default encryption setting has changed in Neo4j 4.0.'.freeze
|
8
|
+
|
9
|
+
SEC_EXCEPTION_CODE_MAPPING = {
|
10
|
+
'Neo.ClientError.Security.Unauthorized' => Neo4j::Driver::Exceptions::AuthenticationException,
|
11
|
+
'Neo.ClientError.Security.AuthorizationExpired' => Neo4j::Driver::Exceptions::AuthorizationExpiredException,
|
12
|
+
'Neo.ClientError.Security.TokenExpired' => Neo4j::Driver::Exceptions::TokenExpiredException
|
13
|
+
}.freeze
|
14
|
+
|
15
|
+
class << self
|
16
|
+
def new_connection_terminated_error(reason)
|
17
|
+
reason ||= DEFAULT_CONN_TERMINATED_REASON
|
18
|
+
Neo4j::Driver::Exceptions::ServiceUnavailableException.new("Connection to the database terminated. #{reason}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def new_result_consumed_error
|
22
|
+
Neo4j::Driver::Exceptions::ResultConsumedException.new(
|
23
|
+
'Cannot access records on this result any more as the result has already been consumed '\
|
24
|
+
'or the query runner where the result is created has already been closed.'
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
def new_neo4j_error(code, message)
|
29
|
+
case extract_error_class(code)
|
30
|
+
when 'ClientError'
|
31
|
+
if extract_error_sub_class(code) == 'Security'
|
32
|
+
SEC_EXCEPTION_CODE_MAPPING[code] || Neo4j::Driver::Exceptions::SecurityException
|
33
|
+
else
|
34
|
+
code == 'Neo.ClientError.Database.DatabaseNotFound' ? Neo4j::Driver::Exceptions::FatalDiscoveryException : Neo4j::Driver::Exceptions::ClientException
|
35
|
+
end
|
36
|
+
when 'TransientError'
|
37
|
+
Neo4j::Driver::Exceptions::TransientException
|
38
|
+
else
|
39
|
+
Neo4j::Driver::Exceptions::DatabaseException
|
40
|
+
end.new(code, message)
|
41
|
+
end
|
42
|
+
|
43
|
+
def fatal?(error)
|
44
|
+
!error.is_a?(Neo4j::Driver::Exceptions::Neo4jException) ||
|
45
|
+
protocol_violation_error?(error.code) ||
|
46
|
+
!client_or_transient_error?(error.code)
|
47
|
+
end
|
48
|
+
|
49
|
+
def rethrow_async_exception(exception)
|
50
|
+
error = exception.cause
|
51
|
+
internal_cause = InternalExceptionCause.new(nil, error.backtrace)
|
52
|
+
error.add_suppressed(internal_cause)
|
53
|
+
|
54
|
+
# do not include Thread.current and this method in the stacktrace
|
55
|
+
current_stack_trace = Thread.current.backtrace.drop(2)
|
56
|
+
error.set_backtrace(current_stack_trace)
|
57
|
+
|
58
|
+
org.neo4j.driver.internal.shaded.io.netty.util.internal.PlatformDependent.throw_exception(error)
|
59
|
+
end
|
60
|
+
|
61
|
+
def add_suppressed(main_error, error)
|
62
|
+
main_error.add_suppressed(error) if main_error.is_a?(Exceptions::Neo4jException) && main_error != error
|
63
|
+
end
|
64
|
+
|
65
|
+
def get_root_cause(error)
|
66
|
+
java.util.Objects.require_non_null(error)
|
67
|
+
|
68
|
+
error.cause ? get_root_cause(error.cause) : error
|
69
|
+
end
|
70
|
+
|
71
|
+
# Exception which is merely a holder of an async stacktrace, which is not the primary stacktrace users are interested in.
|
72
|
+
# Used for blocking API calls that block on async API calls.
|
73
|
+
class InternalExceptionCause < RuntimeError
|
74
|
+
def initialize(message, backtrace)
|
75
|
+
super(message)
|
76
|
+
set_backtrace(backtrace)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def extract_error_class(code)
|
83
|
+
extract_class_from_code(code, 2)
|
84
|
+
end
|
85
|
+
|
86
|
+
def extract_error_sub_class(code)
|
87
|
+
extract_class_from_code(code, 3)
|
88
|
+
end
|
89
|
+
|
90
|
+
def extract_class_from_code(code, parts_counts)
|
91
|
+
parts = code.split('.')
|
92
|
+
parts.length < parts_counts ? '' : parts[parts_counts - 1]
|
93
|
+
end
|
94
|
+
|
95
|
+
def protocol_violation_error?(error_code)
|
96
|
+
error_code&.start_with?('Neo.ClientError.Request')
|
97
|
+
end
|
98
|
+
|
99
|
+
def client_or_transient_error?(error_code)
|
100
|
+
error_code && %w[ClientError TransientError].any?(&error_code.method(:include?))
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Util
|
4
|
+
# Utility class for extracting data.
|
5
|
+
class Extract
|
6
|
+
def initialize
|
7
|
+
raise java.lang.UnsupportedOperationException
|
8
|
+
end
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def list(data, map_function)
|
12
|
+
size = data.length
|
13
|
+
|
14
|
+
case size
|
15
|
+
when 0
|
16
|
+
java.util.Collections.empty_list
|
17
|
+
when 1
|
18
|
+
java.util.Collections.singleton_list(map_function.apply(data.first))
|
19
|
+
else
|
20
|
+
result = []
|
21
|
+
data.each do |value|
|
22
|
+
result << map_function.apply(value)
|
23
|
+
end
|
24
|
+
|
25
|
+
result.freeze
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def map(record, map_function)
|
30
|
+
size = record.length
|
31
|
+
|
32
|
+
case size
|
33
|
+
when 0
|
34
|
+
java.util.Collections.empty_map
|
35
|
+
when 1
|
36
|
+
java.util.Collections.singleton_map[record.keys.first] = map_function.apply(record.first)
|
37
|
+
else
|
38
|
+
map = {}
|
39
|
+
keys = record.keys
|
40
|
+
size.times do |i|
|
41
|
+
map[keys[i]] = map_function.apply(record[i])
|
42
|
+
end
|
43
|
+
|
44
|
+
map.freeze
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def properties(map, map_function)
|
49
|
+
size = map.length
|
50
|
+
|
51
|
+
case size
|
52
|
+
when 0
|
53
|
+
java.util.Collections.empty_list
|
54
|
+
when 1
|
55
|
+
key = map.keys.first
|
56
|
+
value = map[key]
|
57
|
+
java.util.Collections.singleton_list(InternalPair.of(key, map_function.apply(value)))
|
58
|
+
else
|
59
|
+
list = []
|
60
|
+
keys = record.keys
|
61
|
+
map.keys.each do |map_key|
|
62
|
+
map_value = map[map_key]
|
63
|
+
list << InternalPair.of(map_key, map_function.apply(map_value))
|
64
|
+
end
|
65
|
+
|
66
|
+
list.freeze
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def fields(map, map_function)
|
71
|
+
size = map.keys.length
|
72
|
+
|
73
|
+
case size
|
74
|
+
when 0
|
75
|
+
java.util.Collections.empty_list
|
76
|
+
when 1
|
77
|
+
key = map.keys.first
|
78
|
+
value = map[key]
|
79
|
+
java.util.Collections.singleton_list(InternalPair.of(key, map_function.apply(value)))
|
80
|
+
else
|
81
|
+
list = []
|
82
|
+
keys = record.keys
|
83
|
+
size.times do |i|
|
84
|
+
key = keys[i]
|
85
|
+
value = map[key]
|
86
|
+
list << InternalPair.of(key, map_function.apply(value))
|
87
|
+
end
|
88
|
+
|
89
|
+
list.freeze
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def map_of_values(map)
|
94
|
+
return java.util.Collections.empty_map if map.nil? || map.empty?
|
95
|
+
|
96
|
+
result = {}
|
97
|
+
|
98
|
+
map.entry_set.each do |key, value|
|
99
|
+
assert_parameter(value)
|
100
|
+
result[key] = value
|
101
|
+
end
|
102
|
+
|
103
|
+
result
|
104
|
+
end
|
105
|
+
|
106
|
+
def assert_parameter(value)
|
107
|
+
if value.is_a? Types::Node
|
108
|
+
raise Exceptions::ClientException, "Nodes can't be used as parameters."
|
109
|
+
end
|
110
|
+
|
111
|
+
if value.is_a? Types::Relationship
|
112
|
+
raise Exceptions::ClientException, "Relationships can't be used as parameters."
|
113
|
+
end
|
114
|
+
|
115
|
+
if value.is_a? Types::Path
|
116
|
+
raise Exceptions::ClientException, "Paths can't be used as parameters."
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Util
|
4
|
+
class Format
|
5
|
+
def initialize
|
6
|
+
raise java.lang.UnsupportedOperationException
|
7
|
+
end
|
8
|
+
|
9
|
+
# formats map using ':' as key-value separator instead of default '='
|
10
|
+
class << self
|
11
|
+
def format_pairs(entries)
|
12
|
+
case entries.size
|
13
|
+
when 0
|
14
|
+
'{}'
|
15
|
+
when 1
|
16
|
+
"#{key_value_string(entries.first)}"
|
17
|
+
else
|
18
|
+
builder = ""
|
19
|
+
builder << "{"
|
20
|
+
builder << key_value_string(entries.first)
|
21
|
+
|
22
|
+
entries.each do |entry|
|
23
|
+
builder << ","
|
24
|
+
builder << " "
|
25
|
+
builder << key_value_string(entry)
|
26
|
+
end
|
27
|
+
|
28
|
+
builder << "}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
private def key_value_string(entry)
|
33
|
+
"#{entry.keys.first}:#{entry.values.first}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j::Driver
|
4
|
+
module Internal
|
5
|
+
module Util
|
6
|
+
class Futures
|
7
|
+
# TO DO: complete this class, this was partially migrated
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
COMPLETED_WITH_NULL = Concurrent::Promises.fulfilled_future(nil)
|
12
|
+
|
13
|
+
public
|
14
|
+
|
15
|
+
class << self
|
16
|
+
def completed_with_null
|
17
|
+
COMPLETED_WITH_NULL
|
18
|
+
end
|
19
|
+
|
20
|
+
def completed_with_null_if_no_error(future, error)
|
21
|
+
error ? future.reject(error) : future.fulfill(nil)
|
22
|
+
end
|
23
|
+
|
24
|
+
def failed_future(error)
|
25
|
+
Concurrent::Promises.rejected_future(error)
|
26
|
+
end
|
27
|
+
|
28
|
+
def blocking_get(stage)
|
29
|
+
Async::Connection::EventLoopGroupFactory.assert_not_in_event_loop_thread
|
30
|
+
|
31
|
+
interrupted = false
|
32
|
+
begin
|
33
|
+
loop do
|
34
|
+
break stage.value!
|
35
|
+
rescue Interrupt => e
|
36
|
+
# this thread was interrupted while waiting
|
37
|
+
# computation denoted by the future might still be running
|
38
|
+
interrupted = true
|
39
|
+
|
40
|
+
# run the interrupt handler and ignore if it throws
|
41
|
+
# need to wait for IO thread to actually finish, can't simply re-rethrow
|
42
|
+
yield rescue nil
|
43
|
+
# rescue java.util.concurrent.ExecutionException => e
|
44
|
+
# ErrorUtil.rethrow_async_exception(e)
|
45
|
+
end
|
46
|
+
ensure
|
47
|
+
Thread.current.interrupt if interrupted
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def get_now(stage)
|
52
|
+
stage.resolved? ? stage.value! : nil
|
53
|
+
end
|
54
|
+
|
55
|
+
def join_now_or_else_throw(future)
|
56
|
+
if future.resolved?
|
57
|
+
future.value!
|
58
|
+
else
|
59
|
+
raise yield
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def combine_errors(error1, error2)
|
64
|
+
ErrorUtil.add_suppressed(error1, error2) if error1 && error2
|
65
|
+
error1 || error2
|
66
|
+
end
|
67
|
+
|
68
|
+
def on_error_continue(future, error_recorder)
|
69
|
+
Validator.require_non_nil!(future)
|
70
|
+
|
71
|
+
future
|
72
|
+
.then { |value| CompletionResult.new(value, nil) }
|
73
|
+
.rescue do |error|
|
74
|
+
Futures.combine_errors(error_recorder, error)
|
75
|
+
CompletionResult.new(nil, error)
|
76
|
+
end.then_flat do |result|
|
77
|
+
if result.value.nil?
|
78
|
+
yield result.error
|
79
|
+
else
|
80
|
+
Concurrent::Promises.fulfilled_future(result.value)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def future_completing_consumer(future, fulfilled, value, throwable)
|
86
|
+
fulfilled ? future.fulfill(value) : future.reject(throwable)
|
87
|
+
end
|
88
|
+
|
89
|
+
private
|
90
|
+
|
91
|
+
CompletionResult = Struct.new(:value, :error)
|
92
|
+
|
93
|
+
def no_op_interrupt_handler
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Util
|
4
|
+
class Iterables
|
5
|
+
EMPTY_QUEUE = Queue.new
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def single(it)
|
9
|
+
if it.empty?
|
10
|
+
raise ArgumentError, 'Given iterable is empty'
|
11
|
+
end
|
12
|
+
|
13
|
+
result = it.first
|
14
|
+
|
15
|
+
if it.size > 1
|
16
|
+
raise ArgumentError, "Given iterable contains more than one element: #{it}"
|
17
|
+
end
|
18
|
+
|
19
|
+
result
|
20
|
+
end
|
21
|
+
|
22
|
+
def map(alternating_key_value)
|
23
|
+
out = {}
|
24
|
+
|
25
|
+
(0...alternating_key_value.length).step(2) do |i|
|
26
|
+
out[i] = out[i+1]
|
27
|
+
end
|
28
|
+
|
29
|
+
out
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Util
|
4
|
+
class LockUtil
|
5
|
+
class << self
|
6
|
+
def execute_with_lock(lock)
|
7
|
+
lock.lock
|
8
|
+
begin
|
9
|
+
yield
|
10
|
+
ensure
|
11
|
+
lock.unlock
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def execute_with_lock_async(lock)
|
16
|
+
lock.lock
|
17
|
+
Concurrent::Promises.fulfilled_future(lock).then_flat { yield }.on_fulfillment! { lock.unlock }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Util
|
4
|
+
class MetadataExtractor
|
5
|
+
ABSENT_QUERY_ID = -1
|
6
|
+
|
7
|
+
def initialize(result_available_after_metadata_key, result_consumed_after_metadata_key)
|
8
|
+
@result_available_after_metadata_key = result_available_after_metadata_key
|
9
|
+
@result_consumed_after_metadata_key = result_consumed_after_metadata_key
|
10
|
+
end
|
11
|
+
|
12
|
+
def extract_query_keys(metadata)
|
13
|
+
metadata[:fields]&.map(&:to_sym) || []
|
14
|
+
end
|
15
|
+
|
16
|
+
def extract_query_id(metadata)
|
17
|
+
metadata[:qid] || ABSENT_QUERY_ID
|
18
|
+
end
|
19
|
+
|
20
|
+
def extract_result_available_after(metadata)
|
21
|
+
metadata[@result_available_after_metadata_key]
|
22
|
+
end
|
23
|
+
|
24
|
+
def extract_summary(query, connection, result_available_after, metadata)
|
25
|
+
server_info = Summary::InternalServerInfo.new(connection.server_agent, connection.server_address, connection.server_version, connection.protocol.version)
|
26
|
+
db_info = self.class.extract_database_info(metadata)
|
27
|
+
Summary::InternalResultSummary.new(
|
28
|
+
query, server_info, db_info, self.class.extract_query_type(metadata), self.class.extract_counters(metadata),
|
29
|
+
self.class.extract_plan(metadata), self.class.extract_profiled_plan(metadata),
|
30
|
+
self.class.extract_notifications(metadata), result_available_after,
|
31
|
+
self.class.extract_result_consumed_after(metadata, @result_consumed_after_metadata_key))
|
32
|
+
end
|
33
|
+
|
34
|
+
class << self
|
35
|
+
def extract_database_info(metadata)
|
36
|
+
metadata[:db]&.then(&Summary::InternalDatabaseInfo.method(:new)) ||
|
37
|
+
Summary::InternalDatabaseInfo::DEFAULT_DATABASE_INFO
|
38
|
+
end
|
39
|
+
|
40
|
+
def extract_bookmarks(metadata)
|
41
|
+
bookmark_value = metadata[:bookmark]
|
42
|
+
|
43
|
+
return InternalBookmark.parse(bookmark_value) if bookmark_value&.is_a? String
|
44
|
+
|
45
|
+
InternalBookmark.empty
|
46
|
+
end
|
47
|
+
|
48
|
+
def extract_neo4j_server_version(metadata)
|
49
|
+
server_value = extract_server(metadata)
|
50
|
+
server = Util::ServerVersion.version(server_value)
|
51
|
+
return server if Util::ServerVersion::NEO4J_PRODUCT.casecmp?(server.product)
|
52
|
+
raise Neo4j::Driver::Exceptions::UntrustedServerException, "Server does not identify as a genuine Neo4j instance: #{server.product}"
|
53
|
+
end
|
54
|
+
|
55
|
+
def extract_server(metadata)
|
56
|
+
metadata[:server].tap do |version_value|
|
57
|
+
unless version_value
|
58
|
+
raise Neo4j::Driver::Exceptions::UntrustedServerException, 'Server provides no product identifier'
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def extract_query_type(metadata)
|
64
|
+
metadata[:type]
|
65
|
+
end
|
66
|
+
|
67
|
+
def extract_counters(metadata)
|
68
|
+
counters_value = metadata[:stats]
|
69
|
+
counters_value &&
|
70
|
+
Summary::InternalSummaryCounters.new(
|
71
|
+
*%i[
|
72
|
+
nodes-created
|
73
|
+
nodes-deleted
|
74
|
+
relationships-created
|
75
|
+
relationships-deleted
|
76
|
+
properties-set
|
77
|
+
labels-added
|
78
|
+
labels-removed
|
79
|
+
indexes-added
|
80
|
+
indexes-removed
|
81
|
+
constraints-added
|
82
|
+
constraints-removed
|
83
|
+
system-updates
|
84
|
+
].map { |key| counters_value[key].to_i }
|
85
|
+
)
|
86
|
+
end
|
87
|
+
|
88
|
+
def extract_plan(metadata)
|
89
|
+
metadata[:plan]&.then(&Summary::InternalPlan::EXPLAIN_PLAN_FROM_VALUE)
|
90
|
+
end
|
91
|
+
|
92
|
+
def extract_profiled_plan(metadata)
|
93
|
+
metadata[:profile]&.then(&Summary::InternalProfiledPlan::PROFILED_PLAN_FROM_VALUE)
|
94
|
+
end
|
95
|
+
|
96
|
+
def extract_notifications(metadata)
|
97
|
+
metadata[:notifications]&.then do |notifications|
|
98
|
+
notifications.map(&Summary::InternalNotification::VALUE_TO_NOTIFICATION)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def extract_result_consumed_after(metadata, key)
|
103
|
+
metadata[key]&.to_i
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Util
|
4
|
+
class Preconditions
|
5
|
+
# Assert that given expression is true.
|
6
|
+
|
7
|
+
# @param expression the value to check.
|
8
|
+
# @param message the message.
|
9
|
+
# @throws IllegalArgumentException if given value is {@code false}.
|
10
|
+
def self.check_argument(expression, message)
|
11
|
+
raise ArgumentError, message unless expression
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Util
|
4
|
+
class ServerVersion < Struct.new(:product, :major, :minor, :patch)
|
5
|
+
include Comparable
|
6
|
+
NEO4J_PRODUCT = 'Neo4j'
|
7
|
+
V4_4_0 = new(NEO4J_PRODUCT, 4, 4, 0)
|
8
|
+
V4_3_0 = new(NEO4J_PRODUCT, 4, 3, 0)
|
9
|
+
V4_2_0 = new(NEO4J_PRODUCT, 4, 2, 0)
|
10
|
+
V4_1_0 = new(NEO4J_PRODUCT, 4, 1, 0)
|
11
|
+
V4_0_0 = new(NEO4J_PRODUCT, 4, 0, 0)
|
12
|
+
V3_5_0 = new(NEO4J_PRODUCT, 3, 5, 0)
|
13
|
+
V3_4_0 = new(NEO4J_PRODUCT, 3, 4, 0)
|
14
|
+
V_IN_DEV = new(NEO4J_PRODUCT)
|
15
|
+
NEO4J_IN_DEV_VERSION_STRING = "#{NEO4J_PRODUCT}/dev"
|
16
|
+
PATTERN = Regexp.new '([^/]+)/(\\d+)\\.(\\d+)(?:\\.)?(\\d*)(\\.|-|\\+)?([0-9A-Za-z\-.]*)?'
|
17
|
+
|
18
|
+
def <=>(other)
|
19
|
+
unless product == other.product
|
20
|
+
raise ArgumentError, "Comparing different products #{product} with #{other.product}"
|
21
|
+
end
|
22
|
+
values <=> other.values
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_s
|
26
|
+
major || minor || patch ? "#{product}/#{major}.#{minor}.#{patch}" : NEO4J_IN_DEV_VERSION_STRING
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.version(server)
|
30
|
+
PATTERN.match(server) do |matchdata|
|
31
|
+
product = matchdata[1]
|
32
|
+
major = matchdata[2].to_i
|
33
|
+
minor = matchdata[3].to_i
|
34
|
+
patch = matchdata[4].to_i
|
35
|
+
return new(product, major, minor, patch)
|
36
|
+
end
|
37
|
+
return V_IN_DEV if server.casecmp?(NEO4J_IN_DEV_VERSION_STRING)
|
38
|
+
raise ArgumentError, "Cannot parse #{server}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.from_bolt_protocol_version(protocol_version)
|
42
|
+
case protocol_version
|
43
|
+
when Messaging::V4::BoltProtocolV4::VERSION
|
44
|
+
V4_0_0
|
45
|
+
when Messaging::V41::BoltProtocolV41::VERSION
|
46
|
+
V4_1_0
|
47
|
+
when Messaging::V42::BoltProtocolV42::VERSION
|
48
|
+
V4_2_0
|
49
|
+
when Messaging::V43::BoltProtocolV43::VERSION
|
50
|
+
V4_3_0
|
51
|
+
when Messaging::V44::BoltProtocolV44::VERSION
|
52
|
+
V4_4_0
|
53
|
+
else
|
54
|
+
V_IN_DEV
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Neo4j
|
2
|
+
module Driver
|
3
|
+
module Logging1
|
4
|
+
# Obtain a {@link Logger} instance by class, its name will be the fully qualified name of the class.
|
5
|
+
|
6
|
+
# @param clazz class whose name should be used as the {@link Logger} name.
|
7
|
+
# @return {@link Logger} instance
|
8
|
+
private
|
9
|
+
|
10
|
+
def log(clazz)
|
11
|
+
canonical_name = clazz.canonical_name
|
12
|
+
log(canonical_name.nil? ? clazz.name : canonical_name)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Create logging implementation that uses SLF4J.
|
16
|
+
|
17
|
+
# @return new logging implementation.
|
18
|
+
# @throws IllegalStateException if SLF4J is not available.
|
19
|
+
def slf4j
|
20
|
+
unavailability_error = Internal::Logging::Slf4jLogging.check_availability
|
21
|
+
|
22
|
+
raise unavailability_error unless unavailability_error.nil?
|
23
|
+
|
24
|
+
Slf4jLogging.new
|
25
|
+
end
|
26
|
+
|
27
|
+
# Create logging implementation that uses {@link java.util.logging}.
|
28
|
+
|
29
|
+
# @param level the log level.
|
30
|
+
# @return new logging implementation.
|
31
|
+
def java_util_logging(level)
|
32
|
+
Internal::Logging::JULogging.new(level)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Create logging implementation that uses {@link java.util.logging} to log to {@code System.err}.
|
36
|
+
|
37
|
+
# @param level the log level.
|
38
|
+
# @return new logging implementation.
|
39
|
+
def console(level)
|
40
|
+
Internal::Logging::ConsoleLogging.new(level)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Create logging implementation that discards all messages and logs nothing.
|
44
|
+
|
45
|
+
# @return new logging implementation.
|
46
|
+
def none
|
47
|
+
Internal::Logging::DevNullLogging::DEV_NULL_LOGGING
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|