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
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Neo4j
|
4
|
-
module Driver
|
5
|
-
module Internal
|
6
|
-
module Handlers
|
7
|
-
class TransactionPullAllResponseHandler < PullAllResponseHandler
|
8
|
-
def initialize(statement, run_handler, connection, tx, metadata_extractor)
|
9
|
-
super(statement, run_handler, connection, metadata_extractor)
|
10
|
-
@tx = tx
|
11
|
-
@tx.chain run_handler, self
|
12
|
-
end
|
13
|
-
|
14
|
-
def after_success(_metadata); end
|
15
|
-
|
16
|
-
def after_failure(_error)
|
17
|
-
@tx.mark_terminated
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Neo4j
|
4
|
-
module Driver
|
5
|
-
module Internal
|
6
|
-
class InternalDriver
|
7
|
-
extend AutoClosable
|
8
|
-
include ErrorHandling
|
9
|
-
|
10
|
-
attr_reader :session_factory
|
11
|
-
delegate :verify_connectivity, to: :session_factory
|
12
|
-
auto_closable :session
|
13
|
-
|
14
|
-
def initialize(session_factory, logger, resolver)
|
15
|
-
@session_factory = session_factory
|
16
|
-
@closed = Concurrent::AtomicBoolean.new(false)
|
17
|
-
# The below hold references to callbacks called from c,
|
18
|
-
# this prevents garbage collection before driver is garbage collected
|
19
|
-
@logger = logger
|
20
|
-
@resolver = resolver
|
21
|
-
end
|
22
|
-
|
23
|
-
def session(*args)
|
24
|
-
new_session(*Neo4j::Driver::Internal::RubySignature.session(args))
|
25
|
-
end
|
26
|
-
|
27
|
-
def close
|
28
|
-
session_factory.close if @closed.make_true
|
29
|
-
# Bolt::Connector.destroy(@connector)
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def new_session(mode, bookmarks)
|
35
|
-
assert_open
|
36
|
-
session_factory.new_instance(mode, bookmarks)
|
37
|
-
end
|
38
|
-
|
39
|
-
def assert_open
|
40
|
-
raise Exceptions::IllegalStateException, 'This driver instance has already been closed' if @closed.true?
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Neo4j
|
4
|
-
module Driver
|
5
|
-
module Internal
|
6
|
-
class InternalLogger
|
7
|
-
include ErrorHandling
|
8
|
-
|
9
|
-
class << self
|
10
|
-
def register(bolt_config, logger)
|
11
|
-
return unless logger
|
12
|
-
new(bolt_config, logger)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def initialize(bolt_config, logger)
|
17
|
-
@logger = logger
|
18
|
-
@funcs = []
|
19
|
-
bolt_log = Bolt::Log.create(nil)
|
20
|
-
%i[error warning info debug].each do |method|
|
21
|
-
Bolt::Log.send("set_#{method}_func", bolt_log, func(method))
|
22
|
-
end
|
23
|
-
check_error Bolt::Config.set_log(bolt_config, bolt_log)
|
24
|
-
end
|
25
|
-
|
26
|
-
def func(method)
|
27
|
-
Proc.new { |_ptr, message| @logger.send(method, message) }.tap(&@funcs.method(:<<))
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Neo4j
|
4
|
-
module Driver
|
5
|
-
module Internal
|
6
|
-
class InternalResolver
|
7
|
-
include ErrorHandling
|
8
|
-
|
9
|
-
class << self
|
10
|
-
def register(bolt_config, resolver)
|
11
|
-
return unless resolver
|
12
|
-
new(bolt_config, resolver)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def initialize(bolt_config, resolver)
|
17
|
-
@address_resolver_func = ->(_ptr, address, set) {
|
18
|
-
resolver.call(BoltServerAddress.new(Bolt::Address.host(address).first,
|
19
|
-
Bolt::Address.port(address).first.to_i)).each do |server_address|
|
20
|
-
bolt_address = Bolt::Address.create(server_address.host, server_address.port.to_s)
|
21
|
-
check_error Bolt::AddressSet.add(set, bolt_address)
|
22
|
-
end
|
23
|
-
}
|
24
|
-
|
25
|
-
address_resolver = Bolt::AddressResolver.create(nil, @address_resolver_func)
|
26
|
-
check_error Bolt::Config.set_address_resolver(bolt_config, address_resolver)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Neo4j
|
4
|
-
module Driver
|
5
|
-
module Internal
|
6
|
-
class InternalStatementResult
|
7
|
-
include Enumerable
|
8
|
-
|
9
|
-
delegate :consume, :failure, :summary, :finalize, to: :@pull_all_handler
|
10
|
-
|
11
|
-
def initialize(run_handler, pull_all_handler)
|
12
|
-
@run_handler = run_handler
|
13
|
-
@pull_all_handler = pull_all_handler
|
14
|
-
end
|
15
|
-
|
16
|
-
def single
|
17
|
-
@pull_all_handler.next.tap do |record|
|
18
|
-
raise Exceptions::NoSuchRecordException.empty unless record
|
19
|
-
raise Exceptions::NoSuchRecordException.too_many if has_next?
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def next
|
24
|
-
@pull_all_handler.next.tap do |record|
|
25
|
-
raise Exceptions::NoSuchRecordException.no_more unless record
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def peek
|
30
|
-
@pull_all_handler.peek.tap do |record|
|
31
|
-
raise Exceptions::NoSuchRecordException.no_peek_past unless record
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def has_next?
|
36
|
-
@pull_all_handler.peek
|
37
|
-
end
|
38
|
-
|
39
|
-
def each
|
40
|
-
yield @pull_all_handler.next while has_next?
|
41
|
-
end
|
42
|
-
|
43
|
-
def keys
|
44
|
-
@keys ||= begin
|
45
|
-
@pull_all_handler.peek
|
46
|
-
@pull_all_handler.statement_keys
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Neo4j
|
4
|
-
module Driver
|
5
|
-
module Internal
|
6
|
-
module Messaging
|
7
|
-
module BoltProtocol
|
8
|
-
def self.for_version(version)
|
9
|
-
case version
|
10
|
-
when V1::BoltProtocolV1::VERSION
|
11
|
-
V1::BoltProtocolV1::INSTANCE
|
12
|
-
when V2::BoltProtocolV2::VERSION
|
13
|
-
V2::BoltProtocolV2::INSTANCE
|
14
|
-
when V3::BoltProtocolV3::VERSION
|
15
|
-
V3::BoltProtocolV3::INSTANCE
|
16
|
-
else
|
17
|
-
raise Exceptions::ClientException, "Unknown protocol version: #{version}"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Neo4j
|
4
|
-
module Driver
|
5
|
-
module Internal
|
6
|
-
module Messaging
|
7
|
-
module V1
|
8
|
-
class BoltProtocolV1
|
9
|
-
VERSION = 1
|
10
|
-
INSTANCE = new
|
11
|
-
|
12
|
-
METADATA_EXTRACTOR = Util::MetadataExtractor.new('result_available_after', 'result_consumed_after')
|
13
|
-
|
14
|
-
def run_in_auto_commit_transaction(connection, statement, bookmarks_holder, config)
|
15
|
-
# bookmarks are ignored for auto-commit transactions in this version of the protocol
|
16
|
-
|
17
|
-
self.class.tx_config_not_supported if config&.present?
|
18
|
-
|
19
|
-
self.class.run_statement(connection, statement, nil)
|
20
|
-
end
|
21
|
-
|
22
|
-
def run_in_explicit_transaction(connection, statement, tx)
|
23
|
-
self.class.run_statement(connection, statement, tx)
|
24
|
-
end
|
25
|
-
|
26
|
-
class << self
|
27
|
-
def run_statement(connection, statement, tx)
|
28
|
-
query = statement.text
|
29
|
-
params = statement.parameters
|
30
|
-
|
31
|
-
run_handler = Handlers::RunResponseHandler.new(METADATA_EXTRACTOR)
|
32
|
-
pull_all_handler = new_pull_all_handler(statement, run_handler, connection, tx)
|
33
|
-
|
34
|
-
connection.write_and_flush(query, params, run_handler, pull_all_handler)
|
35
|
-
InternalStatementResult.new(run_handler, pull_all_handler)
|
36
|
-
end
|
37
|
-
|
38
|
-
def new_pull_all_handler(statement, run_handler, connection, tx)
|
39
|
-
if tx
|
40
|
-
Handlers::TransactionPullAllResponseHandler.new(statement, run_handler, connection, tx,
|
41
|
-
METADATA_EXTRACTOR)
|
42
|
-
else
|
43
|
-
Handlers::SessionPullAllResponseHandler.new(statement, run_handler, connection,
|
44
|
-
BookmarksHolder::NO_OP, METADATA_EXTRACTOR)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def tx_config_not_supported
|
49
|
-
raise ClientException,
|
50
|
-
'Driver is connected to the database that does not support transaction configuration. ' \
|
51
|
-
'Please upgrade to neo4j 3.5.0 or later in order to use this functionality'
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Neo4j
|
4
|
-
module Driver
|
5
|
-
module Internal
|
6
|
-
module Messaging
|
7
|
-
module V3
|
8
|
-
class BoltProtocolV3
|
9
|
-
VERSION = 3
|
10
|
-
INSTANCE = new
|
11
|
-
METADATA_EXTRACTOR = Util::MetadataExtractor.new('t_first', 't_last')
|
12
|
-
|
13
|
-
def run_in_auto_commit_transaction(connection, statement, bookmarks_holder, config)
|
14
|
-
self.class.run_statement(connection, statement, bookmarks_holder, nil, config)
|
15
|
-
end
|
16
|
-
|
17
|
-
def run_in_explicit_transaction(connection, statement, tx)
|
18
|
-
self.class.run_statement(connection, statement, BookmarksHolder::NO_OP, tx, nil)
|
19
|
-
end
|
20
|
-
|
21
|
-
def begin_transaction(connection, bookmarks, config)
|
22
|
-
begin_handler = Handlers::ResponseHandler.new(connection)
|
23
|
-
connection.begin(bookmarks, config, begin_handler)
|
24
|
-
connection.flush if bookmarks.present?
|
25
|
-
begin_handler
|
26
|
-
end
|
27
|
-
|
28
|
-
def commit_transaction(connection)
|
29
|
-
Handlers::ResponseHandler.new(connection).tap(&connection.method(:commit))
|
30
|
-
end
|
31
|
-
|
32
|
-
def rollback_transaction(connection)
|
33
|
-
Handlers::ResponseHandler.new(connection).tap(&connection.method(:rollback))
|
34
|
-
end
|
35
|
-
|
36
|
-
class << self
|
37
|
-
def run_statement(connection, statement, boomarks_holder, tx, config)
|
38
|
-
query = statement.text
|
39
|
-
params = statement.parameters
|
40
|
-
|
41
|
-
run_handler = Handlers::RunResponseHandler.new(connection, METADATA_EXTRACTOR)
|
42
|
-
pull_all_handler = new_pull_all_handler(statement, run_handler, connection, boomarks_holder, tx)
|
43
|
-
|
44
|
-
connection.write_and_flush(query, params, boomarks_holder, config, run_handler, pull_all_handler)
|
45
|
-
InternalStatementResult.new(run_handler, pull_all_handler)
|
46
|
-
end
|
47
|
-
|
48
|
-
def new_pull_all_handler(statement, run_handler, connection, bookmarks_holder, tx)
|
49
|
-
if tx
|
50
|
-
Handlers::TransactionPullAllResponseHandler.new(statement, run_handler, connection, tx,
|
51
|
-
METADATA_EXTRACTOR)
|
52
|
-
else
|
53
|
-
Handlers::SessionPullAllResponseHandler.new(statement, run_handler, connection, bookmarks_holder,
|
54
|
-
METADATA_EXTRACTOR)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
@@ -1,129 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Neo4j
|
4
|
-
module Driver
|
5
|
-
module Internal
|
6
|
-
class NetworkSession
|
7
|
-
include BookmarksHolder
|
8
|
-
include ErrorHandling
|
9
|
-
extend AutoClosable
|
10
|
-
|
11
|
-
auto_closable :begin_transaction
|
12
|
-
|
13
|
-
def initialize(connection_provider, mode, retry_logic = nil, logging = nil)
|
14
|
-
super()
|
15
|
-
@open = Concurrent::AtomicBoolean.new(true)
|
16
|
-
@connection_provider = connection_provider
|
17
|
-
@mode = mode
|
18
|
-
@retry_logic = retry_logic
|
19
|
-
end
|
20
|
-
|
21
|
-
def run(statement, parameters = {}, config = {})
|
22
|
-
ensure_session_is_open
|
23
|
-
ensure_no_open_tx_before_running_query
|
24
|
-
acquire_connection(@mode)
|
25
|
-
@result = @connection.protocol.run_in_auto_commit_transaction(
|
26
|
-
@connection, Statement.new(statement, parameters), self, config
|
27
|
-
)
|
28
|
-
end
|
29
|
-
|
30
|
-
def read_transaction(**config, &block)
|
31
|
-
transaction(Neo4j::Driver::AccessMode::READ, config, &block)
|
32
|
-
end
|
33
|
-
|
34
|
-
def write_transaction(**config, &block)
|
35
|
-
transaction(Neo4j::Driver::AccessMode::WRITE, config, &block)
|
36
|
-
end
|
37
|
-
|
38
|
-
def close
|
39
|
-
return unless @open.make_false
|
40
|
-
begin
|
41
|
-
@result&.finalize
|
42
|
-
@result&.failure
|
43
|
-
ensure
|
44
|
-
close_transaction_and_release_connection
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def release_connection
|
49
|
-
@connection&.release
|
50
|
-
end
|
51
|
-
|
52
|
-
def begin_transaction(**config)
|
53
|
-
private_begin_transaction(@mode, config)
|
54
|
-
end
|
55
|
-
|
56
|
-
def last_bookmark
|
57
|
-
bookmarks&.max
|
58
|
-
end
|
59
|
-
|
60
|
-
def open?
|
61
|
-
@open.true?
|
62
|
-
end
|
63
|
-
|
64
|
-
private
|
65
|
-
|
66
|
-
def private_begin_transaction(mode, config)
|
67
|
-
ensure_session_is_open
|
68
|
-
ensure_no_open_tx_before_starting_tx
|
69
|
-
acquire_connection(mode)
|
70
|
-
@transaction = ExplicitTransaction.new(@connection, self).begin(bookmarks, config)
|
71
|
-
end
|
72
|
-
|
73
|
-
def transaction(mode, config)
|
74
|
-
@retry_logic.retry do
|
75
|
-
tx = private_begin_transaction(mode, config)
|
76
|
-
result = yield tx
|
77
|
-
tx.success
|
78
|
-
result
|
79
|
-
rescue StandardError => e
|
80
|
-
tx&.failure
|
81
|
-
raise e
|
82
|
-
ensure
|
83
|
-
tx&.close
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def acquire_connection(mode)
|
88
|
-
# make sure previous result is fully consumed and connection is released back to the pool
|
89
|
-
@result&.failure
|
90
|
-
|
91
|
-
# there is no unconsumed error, so one of the following is true:
|
92
|
-
# 1) this is first time connection is acquired in this session
|
93
|
-
# 2) previous result has been successful and is fully consumed
|
94
|
-
# 3) previous result failed and error has been consumed
|
95
|
-
|
96
|
-
raise Exceptions::IllegalStateException, 'Existing open connection detected' if @connection&.open?
|
97
|
-
@connection = @connection_provider.acquire_connection(mode)
|
98
|
-
end
|
99
|
-
|
100
|
-
def close_transaction_and_release_connection
|
101
|
-
@transaction&.close
|
102
|
-
ensure
|
103
|
-
@transaction = nil
|
104
|
-
release_connection
|
105
|
-
end
|
106
|
-
|
107
|
-
def ensure_session_is_open
|
108
|
-
return if open?
|
109
|
-
raise Exceptions::ClientException,
|
110
|
-
'No more interaction with this session are allowed as the current session is already closed.'
|
111
|
-
end
|
112
|
-
|
113
|
-
def ensure_no_open_tx_before_running_query
|
114
|
-
ensure_no_open_tx('Statements cannot be run directly on a session with an open transaction; ' \
|
115
|
-
'either run from within the transaction or use a different session.')
|
116
|
-
end
|
117
|
-
|
118
|
-
def ensure_no_open_tx_before_starting_tx
|
119
|
-
ensure_no_open_tx('You cannot begin a transaction on a session with an open transaction; ' \
|
120
|
-
'either run from within the transaction or use a different session.')
|
121
|
-
end
|
122
|
-
|
123
|
-
def ensure_no_open_tx(error_message)
|
124
|
-
raise Exceptions::ClientException, error_message if @transaction&.open?
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
@@ -1,80 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Neo4j
|
4
|
-
module Driver
|
5
|
-
module Internal
|
6
|
-
module Retry
|
7
|
-
class ExponentialBackoffRetryLogic
|
8
|
-
DEFAULT_MAX_RETRY_TIME = 30.seconds
|
9
|
-
INITIAL_RETRY_DELAY = 1.second
|
10
|
-
RETRY_DELAY_MULTIPLIER = 2.0
|
11
|
-
RETRY_DELAY_JITTER_FACTOR = 0.2
|
12
|
-
|
13
|
-
def initialize(max_retry_time = nil, logger = nil)
|
14
|
-
@max_retry_time = max_retry_time || DEFAULT_MAX_RETRY_TIME
|
15
|
-
@log = logger
|
16
|
-
end
|
17
|
-
|
18
|
-
def retry
|
19
|
-
next_delay = INITIAL_RETRY_DELAY
|
20
|
-
start_time = nil
|
21
|
-
errors = nil
|
22
|
-
begin
|
23
|
-
yield
|
24
|
-
rescue Exceptions::Neo4jException => error
|
25
|
-
if can_retry_on?(error)
|
26
|
-
curr_time = current_time
|
27
|
-
start_time ||= curr_time
|
28
|
-
elapsed_time = curr_time - start_time
|
29
|
-
if elapsed_time < @max_retry_time
|
30
|
-
delay_with_jitter = compute_delay_with_jitter(next_delay)
|
31
|
-
@log&.warn { "Transaction failed and will be retried in #{delay_with_jitter}ms\n#{error}" }
|
32
|
-
sleep(delay_with_jitter)
|
33
|
-
next_delay *= RETRY_DELAY_MULTIPLIER
|
34
|
-
(errors ||= []) << error
|
35
|
-
retry
|
36
|
-
end
|
37
|
-
end
|
38
|
-
add_suppressed(error, errors)
|
39
|
-
raise error
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
def can_retry_on?(error)
|
46
|
-
error.is_a?(Exceptions::SessionExpiredException) ||
|
47
|
-
error.is_a?(Exceptions::ServiceUnavailableException) ||
|
48
|
-
transient_error?(error)
|
49
|
-
end
|
50
|
-
|
51
|
-
def transient_error?(error)
|
52
|
-
# Retries should not happen when transaction was explicitly terminated by the user.
|
53
|
-
# Termination of transaction might result in two different error codes depending on where it was
|
54
|
-
# terminated. These are really client errors but classification on the server is not entirely correct and
|
55
|
-
# they are classified as transient.
|
56
|
-
error.is_a?(Exceptions::TransientException) &&
|
57
|
-
!%w[Neo.TransientError.Transaction.Terminated Neo.TransientError.Transaction.LockClientStopped]
|
58
|
-
.include?(error.code)
|
59
|
-
end
|
60
|
-
|
61
|
-
def compute_delay_with_jitter(delay)
|
62
|
-
jitter = delay * RETRY_DELAY_JITTER_FACTOR
|
63
|
-
min = delay - jitter
|
64
|
-
max = delay + jitter
|
65
|
-
@rand ||= Random.new
|
66
|
-
@rand.rand(min..max)
|
67
|
-
end
|
68
|
-
|
69
|
-
def current_time
|
70
|
-
Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
71
|
-
end
|
72
|
-
|
73
|
-
def add_suppressed(error, suppressed_errors)
|
74
|
-
suppressed_errors&.reject(&error.method(:equal?))&.each(&error.method(:add_suppressed))
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Neo4j
|
4
|
-
module Driver
|
5
|
-
module Internal
|
6
|
-
class SessionFactoryImpl
|
7
|
-
attr_reader :connection_provider
|
8
|
-
delegate :close, :verify_connectivity, to: :connection_provider
|
9
|
-
|
10
|
-
def initialize(connection_provider, retry_logic, config)
|
11
|
-
@connection_provider = connection_provider
|
12
|
-
@retry_logic = retry_logic
|
13
|
-
@config = config
|
14
|
-
end
|
15
|
-
|
16
|
-
def new_instance(mode, bookmarks)
|
17
|
-
create_session(connection_provider, @retry_logic, mode).tap { |session| session.bookmarks = bookmarks }
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def create_session(connection_provider, retry_logic, mode, logging = nil)
|
23
|
-
NetworkSession.new(connection_provider, mode, retry_logic, logging)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,67 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Neo4j
|
4
|
-
module Driver
|
5
|
-
module Internal
|
6
|
-
module Summary
|
7
|
-
class InternalResultSummary
|
8
|
-
attr_reader :server, :counters, :statement, :result_available_after, :result_consumed_after
|
9
|
-
delegate :notifications, :profile, to: :@metadata
|
10
|
-
|
11
|
-
def initialize(statement, result_available_after, bolt_connection)
|
12
|
-
@statement = statement
|
13
|
-
@result_available_after = result_available_after
|
14
|
-
@server = InternalServerInfo.new(bolt_connection)
|
15
|
-
@metadata = RecursiveOpenStruct.new(
|
16
|
-
underscore_keys(Value::ValueAdapter.to_ruby(Bolt::Connection.metadata(bolt_connection))),
|
17
|
-
recurse_over_arrays: true
|
18
|
-
)
|
19
|
-
@result_consumed_after = @metadata.result_consumed_after || @metadata.t_last
|
20
|
-
@counters = InternalSummaryCounters.new(@metadata.stats)
|
21
|
-
end
|
22
|
-
|
23
|
-
def notifications
|
24
|
-
@metadata.notifications || []
|
25
|
-
end
|
26
|
-
|
27
|
-
def plan
|
28
|
-
@metadata.plan || profile
|
29
|
-
end
|
30
|
-
|
31
|
-
alias has_plan? plan
|
32
|
-
alias has_profile? profile
|
33
|
-
|
34
|
-
def method_missing(method)
|
35
|
-
@metadata.send(method)
|
36
|
-
end
|
37
|
-
|
38
|
-
private
|
39
|
-
|
40
|
-
def underscore_keys(arg)
|
41
|
-
case arg
|
42
|
-
when Array
|
43
|
-
arg.map(&method(:underscore_keys))
|
44
|
-
when Hash
|
45
|
-
arg.map { |key, value| [translate_key(key), underscore_keys(value)] }.to_h
|
46
|
-
else
|
47
|
-
arg
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def translate_key(key)
|
52
|
-
case key
|
53
|
-
when :type
|
54
|
-
:statement_type
|
55
|
-
when :args
|
56
|
-
:arguments
|
57
|
-
when :rows
|
58
|
-
:records
|
59
|
-
else
|
60
|
-
key.to_s.underscore.to_sym
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Neo4j
|
4
|
-
module Driver
|
5
|
-
module Internal
|
6
|
-
module Summary
|
7
|
-
class InternalServerInfo
|
8
|
-
attr_reader :address, :version
|
9
|
-
|
10
|
-
def initialize(bolt_connection)
|
11
|
-
address = Bolt::Connection.remote_endpoint(bolt_connection)
|
12
|
-
@address = %i[host port].map { |method| Bolt::Address.send(method, address).first }.join(':')
|
13
|
-
@version = Bolt::Connection.server(bolt_connection).first
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|