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,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Neo4j
|
4
|
-
module Driver
|
5
|
-
module Internal
|
6
|
-
class BoltServerAddress
|
7
|
-
include Net::ServerAddress
|
8
|
-
|
9
|
-
attr_reader :host, :port
|
10
|
-
|
11
|
-
def initialize(host, port)
|
12
|
-
@host = host
|
13
|
-
@port = port
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Neo4j
|
4
|
-
module Driver
|
5
|
-
module Internal
|
6
|
-
module BookmarksHolder
|
7
|
-
extend ActiveSupport::Concern
|
8
|
-
|
9
|
-
included do
|
10
|
-
attr_reader :bookmarks
|
11
|
-
end
|
12
|
-
|
13
|
-
def initialize
|
14
|
-
@bookmarks = []
|
15
|
-
end
|
16
|
-
|
17
|
-
def bookmarks=(bookmarks)
|
18
|
-
bookmarks = Array(bookmarks).select(&:present?)
|
19
|
-
@bookmarks = bookmarks if bookmarks.present?
|
20
|
-
end
|
21
|
-
|
22
|
-
NO_OP = Class.new do
|
23
|
-
include BookmarksHolder
|
24
|
-
|
25
|
-
def bookmarks=; end
|
26
|
-
end.new
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Neo4j
|
4
|
-
module Driver
|
5
|
-
module Internal
|
6
|
-
class DirectConnectionProvider
|
7
|
-
include ErrorHandling
|
8
|
-
|
9
|
-
def initialize(connector, config)
|
10
|
-
@connector = connector
|
11
|
-
@config = config
|
12
|
-
end
|
13
|
-
|
14
|
-
def acquire_connection(mode)
|
15
|
-
Async::DirectConnection.new(@connector, mode, @config)
|
16
|
-
end
|
17
|
-
|
18
|
-
def verify_connectivity
|
19
|
-
acquire_connection(AccessMode::READ).release
|
20
|
-
end
|
21
|
-
|
22
|
-
def close
|
23
|
-
Bolt::Connector.destroy(@connector)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,126 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Neo4j
|
4
|
-
module Driver
|
5
|
-
module Internal
|
6
|
-
class DriverFactory
|
7
|
-
include ErrorHandling
|
8
|
-
BOLT_URI_SCHEME = 'bolt'
|
9
|
-
BOLT_ROUTING_URI_SCHEME = 'bolt+routing'
|
10
|
-
NEO4J_URI_SCHEME = 'neo4j'
|
11
|
-
DEFAULT_PORT = 7687
|
12
|
-
|
13
|
-
def new_instance(uri, auth_token, config)
|
14
|
-
uri = URI(uri)
|
15
|
-
routing_context = routing_context(uri)
|
16
|
-
connector, logger, resolver = create_connector(uri, auth_token, routing_context, config)
|
17
|
-
retry_logic = Retry::ExponentialBackoffRetryLogic.new(config[:max_transaction_retry_time], config[:logger])
|
18
|
-
create_driver(connector, logger, resolver, retry_logic, config).tap(&:verify_connectivity)
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
def create_connector(uri, auth_token, routing_context, config)
|
24
|
-
address = Bolt::Address.create(host(uri).gsub(/^\[(.*)\]$/, '\\1'), port(uri).to_s)
|
25
|
-
bolt_config = bolt_config(config)
|
26
|
-
# callbacks from C to ruby used in logger may cause deadlocks on MRI
|
27
|
-
logger = InternalLogger.register(bolt_config, config[:logger]) if RUBY_PLATFORM.match?(/java/)
|
28
|
-
set_socket_options(bolt_config, config)
|
29
|
-
set_routing_context(bolt_config, routing_context)
|
30
|
-
set_scheme(bolt_config, uri, routing_context)
|
31
|
-
resolver = InternalResolver.register(bolt_config, config[:resolver])
|
32
|
-
[Bolt::Connector.create(address, auth_token, bolt_config), logger, resolver]
|
33
|
-
end
|
34
|
-
|
35
|
-
def bolt_config(config)
|
36
|
-
bolt_config = Bolt::Config.create
|
37
|
-
config.each do |key, value|
|
38
|
-
case key
|
39
|
-
when :max_connection_pool_size
|
40
|
-
check_error Bolt::Config.set_max_pool_size(bolt_config, value)
|
41
|
-
when :max_connection_life_time
|
42
|
-
check_error Bolt::Config.set_max_connection_life_time(bolt_config, DurationNormalizer.milliseconds(value))
|
43
|
-
when :connection_acquisition_timeout
|
44
|
-
check_error Bolt::Config.set_max_connection_acquisition_time(bolt_config,
|
45
|
-
DurationNormalizer.milliseconds(value))
|
46
|
-
when :encryption
|
47
|
-
check_error Bolt::Config.set_transport(
|
48
|
-
bolt_config,
|
49
|
-
value ? Bolt::Config::BOLT_TRANSPORT_ENCRYPTED : Bolt::Config::BOLT_TRANSPORT_PLAINTEXT
|
50
|
-
)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
check_error Bolt::Config.set_user_agent(bolt_config, "neo4j-ruby-driver #{Neo4j::Driver::VERSION}")
|
54
|
-
bolt_config
|
55
|
-
end
|
56
|
-
|
57
|
-
def set_socket_options(bolt_config, config)
|
58
|
-
socket_options = Bolt::SocketOptions.create
|
59
|
-
config.each do |key, value|
|
60
|
-
case key
|
61
|
-
when :connection_timeout
|
62
|
-
check_error Bolt::SocketOptions.set_connect_timeout(socket_options,
|
63
|
-
DurationNormalizer.milliseconds(value))
|
64
|
-
when :keep_alive
|
65
|
-
check_error Bolt::SocketOptions.set_keep_alive(socket_options, value ? 1 : 0)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
check_error Bolt::Config.set_socket_options(bolt_config, socket_options)
|
69
|
-
end
|
70
|
-
|
71
|
-
def routing_context(uri)
|
72
|
-
query = uri.query
|
73
|
-
return if query.blank?
|
74
|
-
URI.decode_www_form(query).to_h
|
75
|
-
end
|
76
|
-
|
77
|
-
def set_routing_context(bolt_config, routing_context)
|
78
|
-
value = Bolt::Value.create
|
79
|
-
check_error Bolt::Config.set_routing_context(bolt_config, Value::ValueAdapter.to_neo(value, routing_context))
|
80
|
-
end
|
81
|
-
|
82
|
-
def host(uri)
|
83
|
-
uri.host.tap { |host| raise ArgumentError, "Invalid address format `#{uri}`" unless host }
|
84
|
-
end
|
85
|
-
|
86
|
-
def port(uri)
|
87
|
-
uri.port&.tap { |port| raise ArgumentError, "Illegal port: #{port}" unless (0..65_535).cover?(port) } ||
|
88
|
-
DEFAULT_PORT
|
89
|
-
end
|
90
|
-
|
91
|
-
def set_scheme(bolt_config, uri, routing_context)
|
92
|
-
check_error Bolt::Config.set_scheme(bolt_config, scheme(uri, routing_context))
|
93
|
-
end
|
94
|
-
|
95
|
-
def scheme(uri, routing_context)
|
96
|
-
scheme = uri.scheme
|
97
|
-
case scheme
|
98
|
-
when BOLT_URI_SCHEME
|
99
|
-
assert_no_routing_context(uri, routing_context)
|
100
|
-
Bolt::Config::BOLT_SCHEME_DIRECT
|
101
|
-
when BOLT_ROUTING_URI_SCHEME, NEO4J_URI_SCHEME
|
102
|
-
Bolt::Config::BOLT_SCHEME_NEO4J
|
103
|
-
else
|
104
|
-
raise Exceptions::ClientException, "Unsupported URI scheme: #{scheme}"
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
def assert_no_routing_context(uri, routing_context)
|
109
|
-
if routing_context
|
110
|
-
raise ArgumentError, "Routing parameters are not supported with scheme 'bolt'. Given URI: '#{uri}'"
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
def create_driver(connector, logger, resolver, retry_logic, config)
|
115
|
-
connection_provider = DirectConnectionProvider.new(connector, config)
|
116
|
-
session_factory = create_session_factory(connection_provider, retry_logic, config)
|
117
|
-
InternalDriver.new(session_factory, logger, resolver)
|
118
|
-
end
|
119
|
-
|
120
|
-
def create_session_factory(connection_provider, retry_logic = nil, config = nil)
|
121
|
-
SessionFactoryImpl.new(connection_provider, retry_logic, config)
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
@@ -1,112 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Neo4j
|
4
|
-
module Driver
|
5
|
-
module Internal
|
6
|
-
module ErrorHandling
|
7
|
-
def check_error(error_code, status = nil)
|
8
|
-
case error_code
|
9
|
-
# Identifies a successful operation which is defined as 0
|
10
|
-
when Bolt::Error::BOLT_SUCCESS # 0
|
11
|
-
nil
|
12
|
-
|
13
|
-
# Permission denied
|
14
|
-
when Bolt::Error::BOLT_PERMISSION_DENIED # 7
|
15
|
-
throw Exceptions::AuthenticationException.new(error_code, 'Permission denied')
|
16
|
-
|
17
|
-
# Connection refused
|
18
|
-
when Bolt::Error::BOLT_CONNECTION_REFUSED # 11
|
19
|
-
throw Exceptions::ServiceUnavailableException.new(error_code, 'unable to acquire connection')
|
20
|
-
|
21
|
-
# Connection pool is full
|
22
|
-
when Bolt::Error::BOLT_POOL_FULL # 0x600
|
23
|
-
throw Exceptions::ClientException.new(
|
24
|
-
error_code,
|
25
|
-
'Unable to acquire connection from the pool within configured maximum time of ' \
|
26
|
-
"#{DurationNormalizer.milliseconds(@config[:connection_acquisition_timeout])}ms"
|
27
|
-
)
|
28
|
-
|
29
|
-
# Routing table retrieval failed
|
30
|
-
when Bolt::Error::BOLT_ROUTING_UNABLE_TO_RETRIEVE_ROUTING_TABLE # 0x800
|
31
|
-
throw Exceptions::ServiceUnavailableException.new(
|
32
|
-
error_code,
|
33
|
-
'Could not perform discovery. No routing servers available.'
|
34
|
-
)
|
35
|
-
|
36
|
-
# Error set in connection
|
37
|
-
when Bolt::Error::BOLT_CONNECTION_HAS_MORE_INFO, Bolt::Error::BOLT_STATUS_SET # 0xFFE, 0xFFF
|
38
|
-
status = Bolt::Connection.status(bolt_connection)
|
39
|
-
unqualified_error(error_code, status)
|
40
|
-
else
|
41
|
-
unqualified_error(error_code, status)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def on_failure(_error); end
|
46
|
-
|
47
|
-
def check_status(status)
|
48
|
-
check_error(Bolt::Status.get_error(status), status)
|
49
|
-
end
|
50
|
-
|
51
|
-
def with_status
|
52
|
-
status = Bolt::Status.create
|
53
|
-
yield status
|
54
|
-
ensure
|
55
|
-
check_status(status)
|
56
|
-
end
|
57
|
-
|
58
|
-
def new_neo4j_error(code:, message:)
|
59
|
-
case code.split('.')[1]
|
60
|
-
when 'ClientError'
|
61
|
-
if code.casecmp('Neo.ClientError.Security.Unauthorized').zero?
|
62
|
-
Exceptions::AuthenticationException
|
63
|
-
else
|
64
|
-
Exceptions::ClientException
|
65
|
-
end
|
66
|
-
when 'TransientError'
|
67
|
-
Exceptions::TransientException
|
68
|
-
else
|
69
|
-
Exceptions::DatabaseException
|
70
|
-
end.new(code, message)
|
71
|
-
end
|
72
|
-
|
73
|
-
private
|
74
|
-
|
75
|
-
def exception_class(state)
|
76
|
-
case state
|
77
|
-
when Bolt::Status::BOLT_CONNECTION_STATE_DEFUNCT
|
78
|
-
Exceptions::SessionExpiredException
|
79
|
-
else
|
80
|
-
Exceptions::Neo4jException
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
def throw(error)
|
85
|
-
if @failure
|
86
|
-
error.add_suppressed(@failure)
|
87
|
-
else
|
88
|
-
on_failure(error)
|
89
|
-
end
|
90
|
-
raise error
|
91
|
-
end
|
92
|
-
|
93
|
-
def unqualified_error(error_code, status)
|
94
|
-
details = details(error_code, status)
|
95
|
-
throw exception_class(details[:state]).new(error_code,
|
96
|
-
details.map { |key, value| "#{key}: `#{value}`" }.join(', '))
|
97
|
-
end
|
98
|
-
|
99
|
-
def details(error_code, status)
|
100
|
-
details = {
|
101
|
-
code: error_code.to_s(16),
|
102
|
-
error: Bolt::Error.get_string(error_code)
|
103
|
-
}
|
104
|
-
return details unless status
|
105
|
-
details.merge(state: Bolt::Status.get_state(status),
|
106
|
-
error: Bolt::Status.get_error(status),
|
107
|
-
error_context: Bolt::Status.get_error_context(status))
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
@@ -1,146 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Neo4j
|
4
|
-
module Driver
|
5
|
-
module Internal
|
6
|
-
class ExplicitTransaction
|
7
|
-
include ErrorHandling
|
8
|
-
|
9
|
-
delegate :finalize, to: :@handler
|
10
|
-
|
11
|
-
def initialize(connection, session)
|
12
|
-
@connection = connection
|
13
|
-
@protocol = connection.protocol
|
14
|
-
@session = session
|
15
|
-
@state = :active
|
16
|
-
end
|
17
|
-
|
18
|
-
def begin(initial_bookmarks, config)
|
19
|
-
chain @protocol.begin_transaction(@connection, initial_bookmarks, config)
|
20
|
-
finalize if initial_bookmarks.present?
|
21
|
-
self
|
22
|
-
rescue StandardError => e
|
23
|
-
@connection.release
|
24
|
-
raise e
|
25
|
-
end
|
26
|
-
|
27
|
-
def run(query, parameters = {})
|
28
|
-
ensure_can_run_queries
|
29
|
-
@result&.failure
|
30
|
-
@result = @protocol.run_in_explicit_transaction(@connection, Statement.new(query, parameters), self)
|
31
|
-
end
|
32
|
-
|
33
|
-
def success
|
34
|
-
@state = :marked_success if @state == :active
|
35
|
-
end
|
36
|
-
|
37
|
-
def failure
|
38
|
-
@state = :marked_failed if %i[active marked_success].include? @state
|
39
|
-
end
|
40
|
-
|
41
|
-
def mark_terminated
|
42
|
-
@state = :terminated
|
43
|
-
end
|
44
|
-
|
45
|
-
def close
|
46
|
-
case @state
|
47
|
-
when :marked_success
|
48
|
-
commit
|
49
|
-
when :committed, :rolled_back
|
50
|
-
nil
|
51
|
-
else
|
52
|
-
rollback
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def open?
|
57
|
-
!%i[committed rolled_back].include? @state
|
58
|
-
end
|
59
|
-
|
60
|
-
def chain(*handlers)
|
61
|
-
handlers.each do |handler|
|
62
|
-
handler.previous = @handler
|
63
|
-
@handler = handler
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
private
|
68
|
-
|
69
|
-
def commit
|
70
|
-
case @state
|
71
|
-
when :committed
|
72
|
-
nil
|
73
|
-
when :rolled_back
|
74
|
-
raise Exceptions::ClientExceptiom, "Can't commit, transaction has been rolled back"
|
75
|
-
else
|
76
|
-
begin
|
77
|
-
do_commit
|
78
|
-
# handleCommitOrRollback( error )
|
79
|
-
ensure
|
80
|
-
transaction_closed(:committed)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def do_commit
|
86
|
-
if @state == :terminated
|
87
|
-
raise Exceptions::ClientException, "Transaction can't be committed. " \
|
88
|
-
'It has been rolled back either because of an error or explicit termination'
|
89
|
-
end
|
90
|
-
|
91
|
-
# @session.bookmarks = @protocol.commit_transaction(@connection)
|
92
|
-
chain @protocol.commit_transaction(@connection)
|
93
|
-
finalize
|
94
|
-
@session.bookmarks = @connection.last_bookmark
|
95
|
-
end
|
96
|
-
|
97
|
-
def rollback
|
98
|
-
case @state
|
99
|
-
when :committed
|
100
|
-
raise ClientException, "Can't rollback, transaction has been committed"
|
101
|
-
when :rolled_back
|
102
|
-
nil
|
103
|
-
else
|
104
|
-
begin
|
105
|
-
do_rollback
|
106
|
-
# resultCursors.retrieveNotConsumedError()
|
107
|
-
# handleCommitOrRollback( error )
|
108
|
-
ensure
|
109
|
-
transaction_closed(:rolled_back)
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
def do_rollback
|
115
|
-
return if @state == :terminated
|
116
|
-
|
117
|
-
chain @protocol.rollback_transaction(@connection)
|
118
|
-
finalize
|
119
|
-
end
|
120
|
-
|
121
|
-
def transaction_closed(new_state)
|
122
|
-
@state = new_state
|
123
|
-
@session.release_connection
|
124
|
-
end
|
125
|
-
|
126
|
-
def ensure_can_run_queries
|
127
|
-
reason =
|
128
|
-
case @state
|
129
|
-
when :committed
|
130
|
-
'Cannot run more statements in this transaction, it has been committed'
|
131
|
-
when :rolled_back
|
132
|
-
'Cannot run more statements in this transaction, it has been rolled back'
|
133
|
-
when :marked_failed
|
134
|
-
'Cannot run more statements in this transaction, it has been marked for failure. ' \
|
135
|
-
'Please either rollback or close this transaction'
|
136
|
-
when :terminated
|
137
|
-
'Cannot run more statements in this transaction, ' \
|
138
|
-
'it has either experienced an fatal error or was explicitly terminated'
|
139
|
-
end
|
140
|
-
|
141
|
-
raise Exceptions::ClientException, reason if reason
|
142
|
-
end
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
@@ -1,104 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Neo4j
|
4
|
-
module Driver
|
5
|
-
module Internal
|
6
|
-
module Handlers
|
7
|
-
class PullAllResponseHandler < ResponseHandler
|
8
|
-
delegate :bolt_connection, to: :connection
|
9
|
-
delegate :statement_keys, to: :run_handler
|
10
|
-
attr_reader :connection
|
11
|
-
|
12
|
-
def initialize(statement, run_handler, connection, metadata_extractor)
|
13
|
-
super(connection)
|
14
|
-
@statement = statement
|
15
|
-
@previous = run_handler
|
16
|
-
@metadate_extractor = metadata_extractor
|
17
|
-
@records = []
|
18
|
-
end
|
19
|
-
|
20
|
-
def consume
|
21
|
-
@ignore_records = true
|
22
|
-
@records.clear
|
23
|
-
finalize
|
24
|
-
@summary
|
25
|
-
rescue StandardError => e
|
26
|
-
on_failure(e)
|
27
|
-
raise e
|
28
|
-
end
|
29
|
-
|
30
|
-
def summary
|
31
|
-
unless @finished
|
32
|
-
while (record = fetch)
|
33
|
-
@records << record
|
34
|
-
end
|
35
|
-
end
|
36
|
-
@summary ||= Summary::InternalResultSummary.new(@statement, run_handler.result_available_after,
|
37
|
-
bolt_connection)
|
38
|
-
end
|
39
|
-
|
40
|
-
def peek
|
41
|
-
@records.first || ((@records << fetch).first unless @finished)
|
42
|
-
end
|
43
|
-
|
44
|
-
def next
|
45
|
-
peek
|
46
|
-
@records.shift
|
47
|
-
end
|
48
|
-
|
49
|
-
def on_success
|
50
|
-
@finished = true
|
51
|
-
summary
|
52
|
-
|
53
|
-
after_success(nil)
|
54
|
-
|
55
|
-
@failure = nil
|
56
|
-
end
|
57
|
-
|
58
|
-
def failure
|
59
|
-
summary
|
60
|
-
super
|
61
|
-
end
|
62
|
-
|
63
|
-
def on_failure(error)
|
64
|
-
@failure = error
|
65
|
-
summary
|
66
|
-
@finished = true
|
67
|
-
|
68
|
-
after_failure(error)
|
69
|
-
end
|
70
|
-
|
71
|
-
def finalize
|
72
|
-
summary unless @ignore_records
|
73
|
-
super
|
74
|
-
end
|
75
|
-
|
76
|
-
private
|
77
|
-
|
78
|
-
def run_handler
|
79
|
-
@previous
|
80
|
-
end
|
81
|
-
|
82
|
-
def fetch
|
83
|
-
run_handler.finalize
|
84
|
-
bolt_connection_fetch = Bolt::Connection.fetch(bolt_connection, request)
|
85
|
-
case bolt_connection_fetch
|
86
|
-
when -1
|
87
|
-
check_status(Bolt::Connection.status(bolt_connection))
|
88
|
-
when 1
|
89
|
-
InternalRecord.new(run_handler.statement_keys,
|
90
|
-
Value::ValueAdapter.to_ruby(Bolt::Connection.field_values(bolt_connection)))
|
91
|
-
else
|
92
|
-
@finished = true
|
93
|
-
check_summary_failure
|
94
|
-
nil
|
95
|
-
end
|
96
|
-
rescue StandardError => e
|
97
|
-
on_failure(e) unless @failure
|
98
|
-
raise e
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Neo4j
|
4
|
-
module Driver
|
5
|
-
module Internal
|
6
|
-
module Handlers
|
7
|
-
class ResponseHandler
|
8
|
-
include ErrorHandling
|
9
|
-
|
10
|
-
delegate :bolt_connection, to: :connection
|
11
|
-
attr_reader :connection, :failure
|
12
|
-
attr_accessor :request, :previous
|
13
|
-
|
14
|
-
def initialize(connection)
|
15
|
-
@connection = connection
|
16
|
-
end
|
17
|
-
|
18
|
-
def finalize
|
19
|
-
return if @finished
|
20
|
-
@finished = true
|
21
|
-
begin
|
22
|
-
previous&.finalize
|
23
|
-
ensure
|
24
|
-
Bolt::Connection.fetch_summary(bolt_connection, request)
|
25
|
-
check_summary_failure
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
def check_summary_failure
|
32
|
-
summary
|
33
|
-
if Bolt::Connection.summary_success(bolt_connection) == 1
|
34
|
-
after_success(nil)
|
35
|
-
else
|
36
|
-
return if previous&.failure
|
37
|
-
failure = Value::ValueAdapter.to_ruby(Bolt::Connection.failure(bolt_connection))
|
38
|
-
raise @failure = new_neo4j_error(**failure)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def summary; end
|
43
|
-
|
44
|
-
def after_success(metadata); end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Neo4j
|
4
|
-
module Driver
|
5
|
-
module Internal
|
6
|
-
module Handlers
|
7
|
-
class RunResponseHandler < ResponseHandler
|
8
|
-
attr_reader :result_available_after
|
9
|
-
|
10
|
-
def initialize(connection, metadata_extractor)
|
11
|
-
super(connection)
|
12
|
-
@statement_keys = []
|
13
|
-
@metadata_extractor = metadata_extractor
|
14
|
-
end
|
15
|
-
|
16
|
-
def statement_keys
|
17
|
-
finalize
|
18
|
-
@statement_keys
|
19
|
-
end
|
20
|
-
|
21
|
-
def finalize
|
22
|
-
return if @finished
|
23
|
-
super
|
24
|
-
@statement_keys = Value::ValueAdapter.to_ruby(Bolt::Connection.field_names(bolt_connection)).map(&:to_sym)
|
25
|
-
metadata = Value::ValueAdapter.to_ruby(Bolt::Connection.metadata(bolt_connection))
|
26
|
-
@result_available_after = metadata[:result_available_after] || metadata[:t_first]
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Neo4j
|
4
|
-
module Driver
|
5
|
-
module Internal
|
6
|
-
module Handlers
|
7
|
-
class SessionPullAllResponseHandler < PullAllResponseHandler
|
8
|
-
def initialize(statement, run_handler, connection, bookmarks_holder, metadata_extractor)
|
9
|
-
super(statement, run_handler, connection, metadata_extractor)
|
10
|
-
@bookmarks_holder = bookmarks_holder
|
11
|
-
end
|
12
|
-
|
13
|
-
def after_success(metadata)
|
14
|
-
@bookmarks_holder.bookmarks = connection.last_bookmark
|
15
|
-
release_connection
|
16
|
-
# @bookmarks_holder.bookmarks = @metadata_extractor.extract_bookmarks(metadata)
|
17
|
-
end
|
18
|
-
|
19
|
-
def after_failure(_error)
|
20
|
-
release_connection
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def release_connection
|
26
|
-
connection.release
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|