neo4j-ruby-driver 1.7.4 → 4.4.0.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -42
- data/lib/loader.rb +2 -1
- data/lib/neo4j/driver/auto_closable.rb +2 -2
- data/lib/neo4j/driver/exceptions/authentication_exception.rb +6 -1
- data/lib/neo4j/driver/exceptions/authorization_expired_exception.rb +14 -0
- data/lib/neo4j/driver/{types/bytes.rb → exceptions/certificate_exception.rb} +2 -2
- data/lib/neo4j/driver/exceptions/client_exception.rb +3 -0
- data/lib/neo4j/driver/exceptions/connection_read_timeout_exception.rb +14 -0
- data/lib/neo4j/driver/exceptions/database_exception.rb +3 -0
- data/lib/neo4j/driver/exceptions/discovery_exception.rb +16 -0
- data/lib/neo4j/driver/exceptions/fatal_discovery_exception.rb +13 -0
- data/lib/neo4j/driver/exceptions/protocol_exception.rb +7 -0
- data/lib/neo4j/driver/exceptions/result_consumed_exception.rb +13 -0
- data/lib/neo4j/driver/exceptions/security_exception.rb +5 -1
- data/lib/neo4j/driver/exceptions/service_unavailable_exception.rb +2 -0
- data/lib/neo4j/driver/exceptions/session_expired_exception.rb +4 -0
- data/lib/neo4j/driver/exceptions/token_expired_exception.rb +15 -0
- data/lib/neo4j/driver/exceptions/transaction_nesting_exception.rb +11 -0
- data/lib/neo4j/driver/exceptions/transient_exception.rb +3 -0
- data/lib/neo4j/driver/exceptions/untrusted_server_exception.rb +1 -0
- data/lib/neo4j/driver/exceptions/value/lossy_coercion.rb +15 -0
- data/lib/neo4j/driver/exceptions/value/not_multi_valued.rb +13 -0
- data/lib/neo4j/driver/exceptions/value/uncoercible.rb +15 -0
- data/lib/neo4j/driver/exceptions/value/unsizable.rb +12 -0
- data/lib/neo4j/driver/exceptions/value/value_exception.rb +12 -0
- data/lib/neo4j/driver/internal/bolt_server_address.rb +97 -0
- data/lib/neo4j/driver/internal/duration_normalizer.rb +1 -1
- data/lib/neo4j/driver/internal/validator.rb +5 -4
- data/{ffi/neo4j/driver/summary/statement_type.rb → lib/neo4j/driver/summary/query_type.rb} +1 -3
- data/lib/neo4j/driver/synchronizable.rb +23 -0
- data/lib/neo4j/driver/version.rb +1 -1
- data/lib/neo4j_ruby_driver.rb +5 -10
- data/{ffi → ruby}/neo4j/driver/access_mode.rb +2 -2
- data/ruby/neo4j/driver/auth_tokens.rb +34 -0
- data/ruby/neo4j/driver/bookmark.rb +21 -0
- data/ruby/neo4j/driver/config.rb +91 -0
- data/ruby/neo4j/driver/graph_database.rb +140 -0
- data/ruby/neo4j/driver/internal/async/connection/bolt_protocol_util.rb +51 -0
- data/ruby/neo4j/driver/internal/async/connection/bootstrap_factory.rb +22 -0
- data/ruby/neo4j/driver/internal/async/connection/channel_attributes.rb +31 -0
- data/ruby/neo4j/driver/internal/async/connection/channel_connected_listener.rb +32 -0
- data/ruby/neo4j/driver/internal/async/connection/channel_connector_impl.rb +77 -0
- data/ruby/neo4j/driver/internal/async/connection/channel_pipeline_builder_impl.rb +22 -0
- data/ruby/neo4j/driver/internal/async/connection/direct_connection.rb +30 -0
- data/ruby/neo4j/driver/internal/async/connection/event_loop_group_factory.rb +83 -0
- data/ruby/neo4j/driver/internal/async/connection/handshake_completed_listener.rb +27 -0
- data/ruby/neo4j/driver/internal/async/connection/handshake_handler.rb +113 -0
- data/ruby/neo4j/driver/internal/async/connection/netty_channel_initializer.rb +57 -0
- data/ruby/neo4j/driver/internal/async/connection/netty_domain_name_resolver.rb +26 -0
- data/ruby/neo4j/driver/internal/async/connection/netty_domain_name_resolver_group.rb +19 -0
- data/ruby/neo4j/driver/internal/async/connection/routing_connection.rb +36 -0
- data/ruby/neo4j/driver/internal/async/connection/stream.rb +12 -0
- data/ruby/neo4j/driver/internal/async/connection/stream_reader.rb +16 -0
- data/ruby/neo4j/driver/internal/async/connection_context.rb +10 -0
- data/ruby/neo4j/driver/internal/async/immutable_connection_context.rb +24 -0
- data/ruby/neo4j/driver/internal/async/inbound/byte_buf_input.rb +30 -0
- data/ruby/neo4j/driver/internal/async/inbound/channel_error_handler.rb +77 -0
- data/ruby/neo4j/driver/internal/async/inbound/chunk_decoder.rb +41 -0
- data/ruby/neo4j/driver/internal/async/inbound/connect_timeout_handler.rb +32 -0
- data/ruby/neo4j/driver/internal/async/inbound/connection_read_timeout_handler.rb +17 -0
- data/ruby/neo4j/driver/internal/async/inbound/inbound_message_dispatcher.rb +172 -0
- data/ruby/neo4j/driver/internal/async/inbound/inbound_message_handler.rb +42 -0
- data/ruby/neo4j/driver/internal/async/inbound/message_decoder.rb +51 -0
- data/ruby/neo4j/driver/internal/async/internal_async_session.rb +98 -0
- data/ruby/neo4j/driver/internal/async/internal_async_transaction.rb +13 -0
- data/ruby/neo4j/driver/internal/async/leak_logging_network_session.rb +34 -0
- data/ruby/neo4j/driver/internal/async/network_connection.rb +196 -0
- data/ruby/neo4j/driver/internal/async/network_session.rb +152 -0
- data/ruby/neo4j/driver/internal/async/outbound/chunk_aware_byte_buf_output.rb +110 -0
- data/ruby/neo4j/driver/internal/async/outbound/outbound_message_handler.rb +39 -0
- data/ruby/neo4j/driver/internal/async/pool/channel.rb +63 -0
- data/ruby/neo4j/driver/internal/async/pool/connection_pool_impl.rb +149 -0
- data/ruby/neo4j/driver/internal/async/pool/controller.rb +25 -0
- data/ruby/neo4j/driver/internal/async/pool/netty_channel_health_checker.rb +87 -0
- data/ruby/neo4j/driver/internal/async/pool/netty_channel_pool.rb +52 -0
- data/ruby/neo4j/driver/internal/async/pool/netty_channel_tracker.rb +137 -0
- data/ruby/neo4j/driver/internal/async/pool/network_connection_factory.rb +21 -0
- data/ruby/neo4j/driver/internal/async/pool/pool_settings.rb +34 -0
- data/ruby/neo4j/driver/internal/async/result_cursors_holder.rb +17 -0
- data/ruby/neo4j/driver/internal/async/unmanaged_transaction.rb +214 -0
- data/ruby/neo4j/driver/internal/bookmark_holder.rb +9 -0
- data/ruby/neo4j/driver/internal/cluster/cluster_composition.rb +58 -0
- data/ruby/neo4j/driver/internal/cluster/cluster_composition_lookup_result.rb +14 -0
- data/ruby/neo4j/driver/internal/cluster/cluster_routing_table.rb +139 -0
- data/ruby/neo4j/driver/internal/cluster/identity_resolver.rb +13 -0
- data/ruby/neo4j/driver/internal/cluster/loadbalancing/least_connected_load_balancing_strategy.rb +68 -0
- data/ruby/neo4j/driver/internal/cluster/loadbalancing/load_balancer.rb +159 -0
- data/ruby/neo4j/driver/internal/cluster/loadbalancing/round_robin_array_index.rb +13 -0
- data/ruby/neo4j/driver/internal/cluster/multi_databases_routing_procedure_runner.rb +34 -0
- data/ruby/neo4j/driver/internal/cluster/rediscovery_impl.rb +238 -0
- data/ruby/neo4j/driver/internal/cluster/route_message_routing_procedure_runner.rb +43 -0
- data/ruby/neo4j/driver/internal/cluster/routing_context.rb +77 -0
- data/ruby/neo4j/driver/internal/cluster/routing_procedure_cluster_composition_provider.rb +64 -0
- data/ruby/neo4j/driver/internal/cluster/routing_procedure_response.rb +19 -0
- data/ruby/neo4j/driver/internal/cluster/routing_settings.rb +24 -0
- data/ruby/neo4j/driver/internal/cluster/routing_table_handler_impl.rb +116 -0
- data/ruby/neo4j/driver/internal/cluster/routing_table_registry_impl.rb +140 -0
- data/ruby/neo4j/driver/internal/cluster/single_database_routing_procedure_runner.rb +76 -0
- data/ruby/neo4j/driver/internal/connection_settings.rb +16 -0
- data/ruby/neo4j/driver/internal/cursor/async_result_cursor_impl.rb +76 -0
- data/ruby/neo4j/driver/internal/cursor/async_result_cursor_only_factory.rb +29 -0
- data/ruby/neo4j/driver/internal/cursor/disposable_async_result_cursor.rb +59 -0
- data/ruby/neo4j/driver/internal/cursor/result_cursor_factory_impl.rb +29 -0
- data/ruby/neo4j/driver/internal/cursor/rx_result_cursor_impl.rb +110 -0
- data/ruby/neo4j/driver/internal/database_name.rb +12 -0
- data/ruby/neo4j/driver/internal/database_name_util.rb +37 -0
- data/ruby/neo4j/driver/internal/default_bookmark_holder.rb +15 -0
- data/ruby/neo4j/driver/internal/default_domain_name_resolver.rb +11 -0
- data/ruby/neo4j/driver/internal/direct_connection_provider.rb +40 -0
- data/ruby/neo4j/driver/internal/driver_factory.rb +127 -0
- data/ruby/neo4j/driver/internal/handlers/begin_tx_response_handler.rb +20 -0
- data/ruby/neo4j/driver/internal/handlers/channel_releasing_reset_response_handler.rb +29 -0
- data/ruby/neo4j/driver/internal/handlers/commit_tx_response_handler.rb +25 -0
- data/ruby/neo4j/driver/internal/handlers/hello_response_handler.rb +65 -0
- data/ruby/neo4j/driver/internal/handlers/init_response_handler.rb +34 -0
- data/ruby/neo4j/driver/internal/handlers/legacy_pull_all_response_handler.rb +228 -0
- data/ruby/neo4j/driver/internal/handlers/no_op_response_handler.rb +16 -0
- data/ruby/neo4j/driver/internal/handlers/ping_response_handler.rb +29 -0
- data/ruby/neo4j/driver/internal/handlers/pull_handlers.rb +32 -0
- data/ruby/neo4j/driver/internal/handlers/pulln/auto_pull_response_handler.rb +174 -0
- data/ruby/neo4j/driver/internal/handlers/pulln/basic_pull_response_handler.rb +288 -0
- data/ruby/neo4j/driver/internal/handlers/pulln/fetch_size_util.rb +20 -0
- data/ruby/neo4j/driver/internal/handlers/reset_response_handler.rb +34 -0
- data/ruby/neo4j/driver/internal/handlers/rollback_tx_response_handler.rb +19 -0
- data/ruby/neo4j/driver/internal/handlers/route_message_response_handler.rb +21 -0
- data/ruby/neo4j/driver/internal/handlers/routing_response_handler.rb +70 -0
- data/ruby/neo4j/driver/internal/handlers/run_response_handler.rb +37 -0
- data/ruby/neo4j/driver/internal/handlers/session_pull_response_completion_listener.rb +34 -0
- data/ruby/neo4j/driver/internal/handlers/transaction_pull_response_completion_listener.rb +20 -0
- data/ruby/neo4j/driver/internal/impersonation_util.rb +22 -0
- data/ruby/neo4j/driver/internal/internal_bookmark.rb +38 -0
- data/ruby/neo4j/driver/internal/internal_database_name.rb +11 -0
- data/ruby/neo4j/driver/internal/internal_driver.rb +78 -0
- data/ruby/neo4j/driver/internal/internal_entity.rb +22 -0
- data/ruby/neo4j/driver/internal/internal_node.rb +21 -0
- data/ruby/neo4j/driver/internal/internal_pair.rb +9 -0
- data/ruby/neo4j/driver/internal/internal_path.rb +35 -0
- data/ruby/neo4j/driver/internal/internal_point2_d.rb +9 -0
- data/ruby/neo4j/driver/internal/internal_point3_d.rb +6 -0
- data/{ffi → ruby}/neo4j/driver/internal/internal_record.rb +2 -1
- data/ruby/neo4j/driver/internal/internal_relationship.rb +26 -0
- data/ruby/neo4j/driver/internal/internal_result.rb +60 -0
- data/ruby/neo4j/driver/internal/internal_session.rb +81 -0
- data/ruby/neo4j/driver/internal/internal_transaction.rb +48 -0
- data/ruby/neo4j/driver/internal/logging/channel_activity_logger.rb +29 -0
- data/ruby/neo4j/driver/internal/logging/channel_error_logger.rb +17 -0
- data/ruby/neo4j/driver/internal/logging/prefixed_logger.rb +19 -0
- data/ruby/neo4j/driver/internal/logging/reformatted_logger.rb +17 -0
- data/ruby/neo4j/driver/internal/messaging/abstract_message_writer.rb +23 -0
- data/ruby/neo4j/driver/internal/messaging/bolt_protocol.rb +30 -0
- data/ruby/neo4j/driver/internal/messaging/bolt_protocol_version.rb +46 -0
- data/ruby/neo4j/driver/internal/messaging/common/common_message_reader.rb +51 -0
- data/ruby/neo4j/driver/internal/messaging/common/common_value.rb +31 -0
- data/ruby/neo4j/driver/internal/messaging/common/common_value_packer.rb +101 -0
- data/ruby/neo4j/driver/internal/messaging/common/common_value_unpacker.rb +234 -0
- data/ruby/neo4j/driver/internal/messaging/encode/begin_message_encoder.rb +15 -0
- data/ruby/neo4j/driver/internal/messaging/encode/commit_message_encoder.rb +14 -0
- data/ruby/neo4j/driver/internal/messaging/encode/discard_all_message_encoder.rb +14 -0
- data/ruby/neo4j/driver/internal/messaging/encode/discard_message_encoder.rb +15 -0
- data/ruby/neo4j/driver/internal/messaging/encode/goodbye_message_encoder.rb +14 -0
- data/ruby/neo4j/driver/internal/messaging/encode/hello_message_encoder.rb +15 -0
- data/ruby/neo4j/driver/internal/messaging/encode/init_message_encoder.rb +16 -0
- data/ruby/neo4j/driver/internal/messaging/encode/pull_all_message_encoder.rb +14 -0
- data/ruby/neo4j/driver/internal/messaging/encode/pull_message_encoder.rb +15 -0
- data/ruby/neo4j/driver/internal/messaging/encode/reset_message_encoder.rb +14 -0
- data/ruby/neo4j/driver/internal/messaging/encode/rollback_message_encoder.rb +14 -0
- data/ruby/neo4j/driver/internal/messaging/encode/route_message_encoder.rb +18 -0
- data/ruby/neo4j/driver/internal/messaging/encode/route_v44_message_encoder.rb +27 -0
- data/ruby/neo4j/driver/internal/messaging/encode/run_message_encoder.rb +16 -0
- data/ruby/neo4j/driver/internal/messaging/encode/run_with_metadata_message_encoder.rb +17 -0
- data/ruby/neo4j/driver/internal/messaging/request/abstract_streaming_message.rb +22 -0
- data/ruby/neo4j/driver/internal/messaging/request/begin_message.rb +26 -0
- data/ruby/neo4j/driver/internal/messaging/request/commit_message.rb +20 -0
- data/ruby/neo4j/driver/internal/messaging/request/discard_all_message.rb +20 -0
- data/ruby/neo4j/driver/internal/messaging/request/discard_message.rb +23 -0
- data/ruby/neo4j/driver/internal/messaging/request/goodbye_message.rb +20 -0
- data/ruby/neo4j/driver/internal/messaging/request/hello_message.rb +31 -0
- data/ruby/neo4j/driver/internal/messaging/request/init_message.rb +19 -0
- data/ruby/neo4j/driver/internal/messaging/request/message_with_metadata.rb +10 -0
- data/ruby/neo4j/driver/internal/messaging/request/multi_database_util.rb +26 -0
- data/ruby/neo4j/driver/internal/messaging/request/pull_all_message.rb +23 -0
- data/ruby/neo4j/driver/internal/messaging/request/pull_message.rb +22 -0
- data/ruby/neo4j/driver/internal/messaging/request/reset_message.rb +32 -0
- data/ruby/neo4j/driver/internal/messaging/request/rollback_message.rb +20 -0
- data/ruby/neo4j/driver/internal/messaging/request/route_message.rb +33 -0
- data/ruby/neo4j/driver/internal/messaging/request/run_message.rb +23 -0
- data/ruby/neo4j/driver/internal/messaging/request/run_with_metadata_message.rb +47 -0
- data/ruby/neo4j/driver/internal/messaging/request/transaction_metadata_builder.rb +24 -0
- data/ruby/neo4j/driver/internal/messaging/response/failure_message.rb +40 -0
- data/ruby/neo4j/driver/internal/messaging/response/ignored_message.rb +29 -0
- data/ruby/neo4j/driver/internal/messaging/response/record_message.rb +33 -0
- data/ruby/neo4j/driver/internal/messaging/response/success_message.rb +34 -0
- data/ruby/neo4j/driver/internal/messaging/v3/bolt_protocol_v3.rb +79 -0
- data/ruby/neo4j/driver/internal/messaging/v3/message_format_v3.rb +17 -0
- data/ruby/neo4j/driver/internal/messaging/v3/message_writer_v3.rb +32 -0
- data/ruby/neo4j/driver/internal/messaging/v4/bolt_protocol_v4.rb +29 -0
- data/ruby/neo4j/driver/internal/messaging/v4/message_format_v4.rb +17 -0
- data/ruby/neo4j/driver/internal/messaging/v4/message_writer_v4.rb +33 -0
- data/ruby/neo4j/driver/internal/messaging/v41/bolt_protocol_v41.rb +25 -0
- data/ruby/neo4j/driver/internal/messaging/v42/bolt_protocol_v42.rb +13 -0
- data/ruby/neo4j/driver/internal/messaging/v43/bolt_protocol_v43.rb +19 -0
- data/ruby/neo4j/driver/internal/messaging/v43/message_format_v43.rb +18 -0
- data/ruby/neo4j/driver/internal/messaging/v43/message_writer_v43.rb +39 -0
- data/ruby/neo4j/driver/internal/messaging/v44/bolt_protocol_v44.rb +17 -0
- data/ruby/neo4j/driver/internal/messaging/v44/message_format_v44.rb +18 -0
- data/ruby/neo4j/driver/internal/messaging/v44/message_writer_v44.rb +30 -0
- data/ruby/neo4j/driver/internal/metrics/connection_pool_metrics_listener.rb +34 -0
- data/ruby/neo4j/driver/internal/metrics/internal_abstract_metrics.rb +46 -0
- data/ruby/neo4j/driver/internal/metrics/internal_connection_pool_metrics.rb +105 -0
- data/ruby/neo4j/driver/internal/metrics/internal_metrics.rb +82 -0
- data/ruby/neo4j/driver/internal/metrics/internal_metrics_provider.rb +18 -0
- data/ruby/neo4j/driver/internal/metrics/listener_event.rb +17 -0
- data/ruby/neo4j/driver/internal/metrics/metrics_provider.rb +24 -0
- data/ruby/neo4j/driver/internal/metrics/time_recorder_listener_event.rb +15 -0
- data/ruby/neo4j/driver/internal/packstream/byte_array_incompatible_packer.rb +12 -0
- data/ruby/neo4j/driver/internal/packstream/pack_input.rb +47 -0
- data/ruby/neo4j/driver/internal/packstream/pack_output.rb +39 -0
- data/ruby/neo4j/driver/internal/packstream/pack_stream.rb +326 -0
- data/ruby/neo4j/driver/internal/packstream/pack_type.rb +17 -0
- data/ruby/neo4j/driver/internal/retry/exponential_backoff_retry_logic.rb +151 -0
- data/ruby/neo4j/driver/internal/revocation_strategy.rb +19 -0
- data/ruby/neo4j/driver/internal/scheme.rb +32 -0
- data/ruby/neo4j/driver/internal/security/internal_auth_token.rb +15 -0
- data/ruby/neo4j/driver/internal/security/security_plan_impl.rb +92 -0
- data/ruby/neo4j/driver/internal/security_setting.rb +73 -0
- data/ruby/neo4j/driver/internal/session_factory_impl.rb +32 -0
- data/ruby/neo4j/driver/internal/spi/connection.rb +19 -0
- data/ruby/neo4j/driver/internal/spi/connection_pool.rb +9 -0
- data/ruby/neo4j/driver/internal/spi/response_handler.rb +23 -0
- data/ruby/neo4j/driver/internal/summary/internal_database_info.rb +7 -0
- data/ruby/neo4j/driver/internal/summary/internal_input_position.rb +11 -0
- data/ruby/neo4j/driver/internal/summary/internal_notification.rb +16 -0
- data/ruby/neo4j/driver/internal/summary/internal_plan.rb +41 -0
- data/ruby/neo4j/driver/internal/summary/internal_profiled_plan.rb +32 -0
- data/ruby/neo4j/driver/internal/summary/internal_result_summary.rb +33 -0
- data/ruby/neo4j/driver/internal/summary/internal_server_info.rb +6 -0
- data/ruby/neo4j/driver/internal/summary/internal_summary_counters.rb +18 -0
- data/ruby/neo4j/driver/internal/svm/netty_substitutions.rb +196 -0
- data/ruby/neo4j/driver/internal/svm/z_lib_substitutions.rb +21 -0
- data/ruby/neo4j/driver/internal/util/certificate_tool.rb +65 -0
- data/ruby/neo4j/driver/internal/util/clock.rb +29 -0
- data/ruby/neo4j/driver/internal/util/error_util.rb +104 -0
- data/ruby/neo4j/driver/internal/util/extract.rb +123 -0
- data/ruby/neo4j/driver/internal/util/format.rb +39 -0
- data/ruby/neo4j/driver/internal/util/futures.rb +99 -0
- data/ruby/neo4j/driver/internal/util/iterables.rb +35 -0
- data/ruby/neo4j/driver/internal/util/lock_util.rb +23 -0
- data/ruby/neo4j/driver/internal/util/metadata_extractor.rb +109 -0
- data/ruby/neo4j/driver/internal/util/mutex.rb +9 -0
- data/ruby/neo4j/driver/internal/util/preconditions.rb +16 -0
- data/ruby/neo4j/driver/internal/util/server_version.rb +60 -0
- data/ruby/neo4j/driver/logging1.rb +51 -0
- data/ruby/neo4j/driver/net/server_address1.rb +9 -0
- data/ruby/neo4j/driver/query.rb +48 -0
- data/ruby/neo4j/driver/records.rb +13 -0
- data/ruby/neo4j/driver/session_config.rb +15 -0
- data/ruby/neo4j/driver/transaction_config.rb +46 -0
- data/ruby/neo4j/driver/values.rb +26 -0
- data/ruby/neo4j/driver.rb +30 -0
- metadata +277 -102
- data/ffi/bolt/address.rb +0 -11
- data/ffi/bolt/address_resolver.rb +0 -12
- data/ffi/bolt/address_set.rb +0 -9
- data/ffi/bolt/auth.rb +0 -10
- data/ffi/bolt/auto_releasable.rb +0 -22
- data/ffi/bolt/boolean.rb +0 -9
- data/ffi/bolt/bytes.rb +0 -10
- data/ffi/bolt/config.rb +0 -45
- data/ffi/bolt/connection.rb +0 -44
- data/ffi/bolt/connector.rb +0 -17
- data/ffi/bolt/dictionary.rb +0 -15
- data/ffi/bolt/error.rb +0 -74
- data/ffi/bolt/float.rb +0 -9
- data/ffi/bolt/integer.rb +0 -9
- data/ffi/bolt/library.rb +0 -12
- data/ffi/bolt/lifecycle.rb +0 -9
- data/ffi/bolt/list.rb +0 -10
- data/ffi/bolt/log.rb +0 -16
- data/ffi/bolt/socket_options.rb +0 -14
- data/ffi/bolt/status.rb +0 -25
- data/ffi/bolt/string.rb +0 -9
- data/ffi/bolt/structure.rb +0 -10
- data/ffi/bolt/value.rb +0 -35
- data/ffi/neo4j/driver/auth_tokens.rb +0 -18
- data/ffi/neo4j/driver/config.rb +0 -40
- data/ffi/neo4j/driver/graph_database.rb +0 -52
- data/ffi/neo4j/driver/internal/async/access_mode_connection.rb +0 -19
- data/ffi/neo4j/driver/internal/async/direct_connection.rb +0 -106
- data/ffi/neo4j/driver/internal/bolt_server_address.rb +0 -18
- data/ffi/neo4j/driver/internal/bookmarks_holder.rb +0 -30
- data/ffi/neo4j/driver/internal/direct_connection_provider.rb +0 -28
- data/ffi/neo4j/driver/internal/driver_factory.rb +0 -125
- data/ffi/neo4j/driver/internal/error_handling.rb +0 -112
- data/ffi/neo4j/driver/internal/explicit_transaction.rb +0 -146
- data/ffi/neo4j/driver/internal/handlers/pull_all_response_handler.rb +0 -104
- data/ffi/neo4j/driver/internal/handlers/response_handler.rb +0 -49
- data/ffi/neo4j/driver/internal/handlers/run_response_handler.rb +0 -32
- data/ffi/neo4j/driver/internal/handlers/session_pull_all_response_handler.rb +0 -32
- data/ffi/neo4j/driver/internal/handlers/transaction_pull_all_response_handler.rb +0 -23
- data/ffi/neo4j/driver/internal/internal_driver.rb +0 -45
- data/ffi/neo4j/driver/internal/internal_logger.rb +0 -32
- data/ffi/neo4j/driver/internal/internal_resolver.rb +0 -31
- data/ffi/neo4j/driver/internal/internal_statement_result.rb +0 -52
- data/ffi/neo4j/driver/internal/messaging/bolt_protocol.rb +0 -24
- data/ffi/neo4j/driver/internal/messaging/v1/bolt_protocol_v1.rb +0 -59
- data/ffi/neo4j/driver/internal/messaging/v2/bolt_protocol_v2.rb +0 -16
- data/ffi/neo4j/driver/internal/messaging/v3/bolt_protocol_v3.rb +0 -63
- data/ffi/neo4j/driver/internal/network_session.rb +0 -129
- data/ffi/neo4j/driver/internal/retry/exponential_backoff_retry_logic.rb +0 -80
- data/ffi/neo4j/driver/internal/session_factory_impl.rb +0 -28
- data/ffi/neo4j/driver/internal/summary/internal_result_summary.rb +0 -67
- data/ffi/neo4j/driver/internal/summary/internal_server_info.rb +0 -19
- data/ffi/neo4j/driver/internal/summary/internal_summary_counters.rb +0 -23
- data/ffi/neo4j/driver/internal/util/metadata_extractor.rb +0 -15
- data/ffi/neo4j/driver/internal/value/base_time_value.rb +0 -22
- data/ffi/neo4j/driver/internal/value/date_value.rb +0 -25
- data/ffi/neo4j/driver/internal/value/duration_value.rb +0 -27
- data/ffi/neo4j/driver/internal/value/local_date_time_value.rb +0 -24
- data/ffi/neo4j/driver/internal/value/local_time_value.rb +0 -19
- data/ffi/neo4j/driver/internal/value/node_value.rb +0 -18
- data/ffi/neo4j/driver/internal/value/offset_time_value.rb +0 -25
- data/ffi/neo4j/driver/internal/value/path_value.rb +0 -41
- data/ffi/neo4j/driver/internal/value/point2_d_value.rb +0 -24
- data/ffi/neo4j/driver/internal/value/point3_d_value.rb +0 -24
- data/ffi/neo4j/driver/internal/value/relationship_value.rb +0 -18
- data/ffi/neo4j/driver/internal/value/structure_value.rb +0 -42
- data/ffi/neo4j/driver/internal/value/time_with_zone_id_value.rb +0 -25
- data/ffi/neo4j/driver/internal/value/time_with_zone_offset_value.rb +0 -28
- data/ffi/neo4j/driver/internal/value/unbound_relationship_value.rb +0 -18
- data/ffi/neo4j/driver/internal/value/value_adapter.rb +0 -101
- data/ffi/neo4j/driver/net/server_address.rb +0 -13
- data/ffi/neo4j/driver/statement.rb +0 -15
- data/ffi/neo4j/driver/types/entity.rb +0 -21
- data/ffi/neo4j/driver/types/node.rb +0 -16
- data/ffi/neo4j/driver/types/path.rb +0 -35
- data/ffi/neo4j/driver/types/relationship.rb +0 -19
- data/ffi/neo4j/driver.rb +0 -61
- data/lib/neo4j/driver/internal/ruby_signature.rb +0 -18
@@ -0,0 +1,288 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Handlers
|
4
|
+
module Pulln
|
5
|
+
class BasicPullResponseHandler
|
6
|
+
include Spi::ResponseHandler
|
7
|
+
attr :state
|
8
|
+
|
9
|
+
def initialize(query, run_response_handler, connection, metadata_extractor, completion_listener)
|
10
|
+
super()
|
11
|
+
@query = Validator.require_non_nil!(query)
|
12
|
+
@run_response_handler = Validator.require_non_nil!(run_response_handler)
|
13
|
+
@metadata_extractor = Validator.require_non_nil!(metadata_extractor)
|
14
|
+
@connection = Validator.require_non_nil!(connection)
|
15
|
+
@completion_listener = Validator.require_non_nil!(completion_listener)
|
16
|
+
@state = State::READY_STATE
|
17
|
+
@to_request = 0
|
18
|
+
end
|
19
|
+
|
20
|
+
def state=(state)
|
21
|
+
@state = state
|
22
|
+
signal
|
23
|
+
end
|
24
|
+
|
25
|
+
def on_success(metadata)
|
26
|
+
assert_record_and_summary_consumer_installed
|
27
|
+
@state.on_success(self, metadata)
|
28
|
+
end
|
29
|
+
|
30
|
+
def on_failure(error)
|
31
|
+
assert_record_and_summary_consumer_installed
|
32
|
+
@state.on_failure(self, error)
|
33
|
+
end
|
34
|
+
|
35
|
+
def on_record(fields)
|
36
|
+
assert_record_and_summary_consumer_installed
|
37
|
+
@state.on_record(self, fields)
|
38
|
+
end
|
39
|
+
|
40
|
+
def request(size)
|
41
|
+
assert_record_and_summary_consumer_installed
|
42
|
+
@state.request(self, size)
|
43
|
+
end
|
44
|
+
|
45
|
+
def cancel
|
46
|
+
assert_record_and_summary_consumer_installed
|
47
|
+
@state.cancel(self)
|
48
|
+
end
|
49
|
+
|
50
|
+
def complete_with_failure(error)
|
51
|
+
@completion_listener.after_failure(error)
|
52
|
+
complete(extract_result_summary, error)
|
53
|
+
end
|
54
|
+
|
55
|
+
def complete_with_success(metadata)
|
56
|
+
@completion_listener.after_success(metadata)
|
57
|
+
summary, exception =
|
58
|
+
begin
|
59
|
+
[extract_result_summary(**metadata), nil]
|
60
|
+
rescue Exceptions::Neo4jException => e
|
61
|
+
[extract_result_summary, e]
|
62
|
+
end
|
63
|
+
complete(summary, exception)
|
64
|
+
end
|
65
|
+
|
66
|
+
def success_has_more
|
67
|
+
if @to_request > 0 || @to_request == FetchSizeUtil::UNLIMITED_FETCH_SIZE
|
68
|
+
request(@to_request)
|
69
|
+
@to_request = 0
|
70
|
+
end
|
71
|
+
|
72
|
+
# summary consumer use (null, null) to identify done handling of success with has_more
|
73
|
+
@summary_consumer.call(nil, nil)
|
74
|
+
end
|
75
|
+
|
76
|
+
def handle_record(fields)
|
77
|
+
record = InternalRecord.new(@run_response_handler.query_keys, fields)
|
78
|
+
@record_consumer.call(record, nil)
|
79
|
+
end
|
80
|
+
|
81
|
+
def write_pull(n)
|
82
|
+
@connection.write_and_flush(Messaging::Request::PullMessage.new(n, @run_response_handler.query_id), self)
|
83
|
+
end
|
84
|
+
|
85
|
+
def discard_all
|
86
|
+
@connection.write_and_flush(Messaging::Request::DiscardMessage.new_discard_all_message(@run_response_handler.query_id), self)
|
87
|
+
end
|
88
|
+
|
89
|
+
def install_summary_consumer(&summary_consumer)
|
90
|
+
raise Exceptions::IllegalStateException, 'Summary consumer already installed.' if @summary_consumer
|
91
|
+
|
92
|
+
@summary_consumer = summary_consumer
|
93
|
+
end
|
94
|
+
|
95
|
+
def install_record_consumer(&record_consumer)
|
96
|
+
raise Exceptions::IllegalStateException, 'Record consumer already installed.' if @record_consumer
|
97
|
+
|
98
|
+
@record_consumer = record_consumer
|
99
|
+
end
|
100
|
+
|
101
|
+
def done?
|
102
|
+
@state == State::SUCEEDED_STATE || @state == State::FAILURE_STATE
|
103
|
+
end
|
104
|
+
|
105
|
+
private def extract_result_summary(**metadata)
|
106
|
+
result_available_after = @run_response_handler.result_available_after
|
107
|
+
@metadata_extractor.extract_summary(@query, @connection, result_available_after, metadata)
|
108
|
+
end
|
109
|
+
|
110
|
+
private def add_to_request(to_add)
|
111
|
+
return if @to_request == FetchSizeUtil::UNLIMITED_FETCH_SIZE
|
112
|
+
|
113
|
+
# pull all
|
114
|
+
return @to_request = FetchSizeUtil::UNLIMITED_FETCH_SIZE if to_add == FetchSizeUtil::UNLIMITED_FETCH_SIZE
|
115
|
+
|
116
|
+
if to_add <= 0
|
117
|
+
raise ArgumentError, "Cannot request record amount that is less than or equal to 0. Request amount: #{to_add}"
|
118
|
+
end
|
119
|
+
|
120
|
+
@to_request += to_add
|
121
|
+
|
122
|
+
# to_add is already at least 1, we hit buffer overflow
|
123
|
+
@to_request = [@to_request, LONG_MAX_VALUE].min
|
124
|
+
end
|
125
|
+
|
126
|
+
private def assert_record_and_summary_consumer_installed
|
127
|
+
# no need to check if we've finished.
|
128
|
+
return if done?
|
129
|
+
|
130
|
+
if @record_consumer.nil? || @summary_consumer.nil?
|
131
|
+
raise Exceptions::IllegalStateException, "Access record stream without record consumer and/or summary consumer. Record consumer=#{@record_consumer}, Summary consumer=#{@summary_consumer}"
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
private def complete(summary, error)
|
136
|
+
# we first inform the summary consumer to ensure when streaming finished, summary is definitely available.
|
137
|
+
@summary_consumer.call(summary, error)
|
138
|
+
# record consumer use (nil, nil) to identify the end of record stream
|
139
|
+
@record_consumer.call(nil, error)
|
140
|
+
dispose
|
141
|
+
end
|
142
|
+
|
143
|
+
private def dispose
|
144
|
+
# release the reference to the consumers who hold the reference to subscribers which shall be released when subscription is completed.
|
145
|
+
@record_consumer = nil
|
146
|
+
@summary_consumer = nil
|
147
|
+
end
|
148
|
+
|
149
|
+
module State
|
150
|
+
READY_STATE = Class.new do
|
151
|
+
def on_success(context, metadata)
|
152
|
+
context.state = SUCCEEDED_STATE
|
153
|
+
context.complete_with_success(metadata)
|
154
|
+
end
|
155
|
+
|
156
|
+
def on_failure(context, error)
|
157
|
+
context.state = FAILURE_STATE
|
158
|
+
context.complete_with_failure(error)
|
159
|
+
end
|
160
|
+
|
161
|
+
def on_record(context, _fields)
|
162
|
+
context.state = READY_STATE
|
163
|
+
end
|
164
|
+
|
165
|
+
def request(context, n)
|
166
|
+
context.state = STREAMING_STATE
|
167
|
+
context.write_pull(n)
|
168
|
+
end
|
169
|
+
|
170
|
+
def cancel(context)
|
171
|
+
context.state = CANCELLED_STATE
|
172
|
+
context.discard_all
|
173
|
+
end
|
174
|
+
end.new
|
175
|
+
|
176
|
+
STREAMING_STATE = Class.new do
|
177
|
+
def on_success(context, metadata)
|
178
|
+
if metadata[:has_more]
|
179
|
+
context.state = READY_STATE
|
180
|
+
context.success_has_more
|
181
|
+
else
|
182
|
+
context.state = SUCEEDED_STATE
|
183
|
+
context.complete_with_success(metadata)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
def on_failure(context, error)
|
188
|
+
context.state = FAILURE_STATE
|
189
|
+
context.complete_with_failure(error)
|
190
|
+
end
|
191
|
+
|
192
|
+
def on_record(context, fields)
|
193
|
+
context.state = STREAMING_STATE
|
194
|
+
context.handle_record(fields)
|
195
|
+
end
|
196
|
+
|
197
|
+
def request(context, n)
|
198
|
+
context.state = STREAMING_STATE
|
199
|
+
context.add_to_request(n)
|
200
|
+
end
|
201
|
+
|
202
|
+
def cancel(context)
|
203
|
+
context.state = CANCELLED_STATE
|
204
|
+
end
|
205
|
+
end.new
|
206
|
+
|
207
|
+
CANCELLED_STATE = Class.new do
|
208
|
+
def on_success(context, metadata)
|
209
|
+
if metadata[:has_more]
|
210
|
+
context.state = CANCELLED_STATE
|
211
|
+
context.discard_all
|
212
|
+
else
|
213
|
+
context.state = SUCEEDED_STATE
|
214
|
+
context.complete_with_success(metadata)
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
def on_failure(context, error)
|
219
|
+
context.state = FAILURE_STATE
|
220
|
+
context.complete_with_failure(error)
|
221
|
+
end
|
222
|
+
|
223
|
+
def on_record(context, _fields)
|
224
|
+
context.state = CANCELLED_STATE
|
225
|
+
end
|
226
|
+
|
227
|
+
def request(context, _n)
|
228
|
+
context.state = CANCELLED_STATE
|
229
|
+
end
|
230
|
+
|
231
|
+
def cancel(context)
|
232
|
+
context.state = CANCELLED_STATE
|
233
|
+
end
|
234
|
+
end.new
|
235
|
+
|
236
|
+
SUCEEDED_STATE = Class.new do
|
237
|
+
def on_success(context, metadata)
|
238
|
+
context.state = SUCEEDED_STATE
|
239
|
+
context.complete_with_success(metadata)
|
240
|
+
end
|
241
|
+
|
242
|
+
def on_failure(context, error)
|
243
|
+
context.state = FAILURE_STATE
|
244
|
+
context.complete_with_failure(error)
|
245
|
+
end
|
246
|
+
|
247
|
+
def on_record(context, _fields)
|
248
|
+
context.state = SUCEEDED_STATE
|
249
|
+
end
|
250
|
+
|
251
|
+
def request(context, _n)
|
252
|
+
context.state = SUCEEDED_STATE
|
253
|
+
end
|
254
|
+
|
255
|
+
def cancel(context)
|
256
|
+
context.state = SUCEEDED_STATE
|
257
|
+
end
|
258
|
+
end.new
|
259
|
+
|
260
|
+
FAILURE_STATE = Class.new do
|
261
|
+
def on_success(context, metadata)
|
262
|
+
context.state = SUCEEDED_STATE
|
263
|
+
context.complete_with_success(metadata)
|
264
|
+
end
|
265
|
+
|
266
|
+
def on_failure(context, error)
|
267
|
+
context.state = FAILURE_STATE
|
268
|
+
context.complete_with_failure(error)
|
269
|
+
end
|
270
|
+
|
271
|
+
def on_record(context, _fields)
|
272
|
+
context.state = FAILURE_STATE
|
273
|
+
end
|
274
|
+
|
275
|
+
def request(context, _n)
|
276
|
+
context.state = FAILURE_STATE
|
277
|
+
end
|
278
|
+
|
279
|
+
def cancel(context)
|
280
|
+
context.state = FAILURE_STATE
|
281
|
+
end
|
282
|
+
end.new
|
283
|
+
end
|
284
|
+
end
|
285
|
+
end
|
286
|
+
end
|
287
|
+
end
|
288
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Handlers
|
4
|
+
module Pulln
|
5
|
+
class FetchSizeUtil
|
6
|
+
UNLIMITED_FETCH_SIZE = -1
|
7
|
+
DEFAULT_FETCH_SIZE = 1000
|
8
|
+
|
9
|
+
def self.assert_valid_fetch_size(size)
|
10
|
+
if size <= 0 && size != UNLIMITED_FETCH_SIZE
|
11
|
+
raise ArgumentError, "The record fetch size may not be 0 or negative. Illegal record fetch size: #{size}."
|
12
|
+
end
|
13
|
+
|
14
|
+
size
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Handlers
|
4
|
+
class ResetResponseHandler
|
5
|
+
include Spi::ResponseHandler
|
6
|
+
|
7
|
+
def initialize(message_dispatcher, completion_future = nil)
|
8
|
+
@message_dispatcher = message_dispatcher
|
9
|
+
@completion_future = completion_future
|
10
|
+
end
|
11
|
+
|
12
|
+
def on_success(_metadata)
|
13
|
+
reset_completed(true)
|
14
|
+
end
|
15
|
+
|
16
|
+
def on_failure(_error)
|
17
|
+
reset_completed(false)
|
18
|
+
end
|
19
|
+
|
20
|
+
def on_record(_fields)
|
21
|
+
raise java.lang.UnsupportedOperationException
|
22
|
+
end
|
23
|
+
|
24
|
+
private def reset_completed(_success)
|
25
|
+
@message_dispatcher.clear_current_error
|
26
|
+
|
27
|
+
unless @completion_future.nil?
|
28
|
+
@completion_future.complete(nil)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Handlers
|
4
|
+
class RollbackTxResponseHandler
|
5
|
+
include Spi::ResponseHandler
|
6
|
+
def on_success(_metadata)
|
7
|
+
end
|
8
|
+
|
9
|
+
def on_failure(error)
|
10
|
+
raise error
|
11
|
+
end
|
12
|
+
|
13
|
+
def on_record(fields)
|
14
|
+
raise "Transaction rollback is not expected to receive records: #{fields}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Handlers
|
4
|
+
class RouteMessageResponseHandler < Struct.new(:completion_listener)
|
5
|
+
include Spi::ResponseHandler
|
6
|
+
|
7
|
+
def on_success(metadata)
|
8
|
+
completion_listener.routing_table = metadata[:rt]
|
9
|
+
end
|
10
|
+
|
11
|
+
def on_failure(error)
|
12
|
+
raise error
|
13
|
+
end
|
14
|
+
|
15
|
+
def on_record(fields)
|
16
|
+
raise "Route is not expected to receive records: #{fields}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Handlers
|
4
|
+
class RoutingResponseHandler
|
5
|
+
include Spi::ResponseHandler
|
6
|
+
delegate :on_success, :on_record, :can_manage_auto_read, :disable_auto_read_management, to: :@delegate
|
7
|
+
|
8
|
+
def initialize(delegate, address, access_mode, error_handler)
|
9
|
+
@delegate = delegate
|
10
|
+
@address = address
|
11
|
+
@access_mode = access_mode
|
12
|
+
@error_handler = error_handler
|
13
|
+
end
|
14
|
+
|
15
|
+
def on_failure(error)
|
16
|
+
new_error = handled_error(error)
|
17
|
+
@delegate.on_failure(new_error)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def handled_error(received_error)
|
23
|
+
# TODO: probably not necessary with concurrent-ruby as it might not wrap exceptions like java
|
24
|
+
error = Futures.completion_exception_cause(received_error)
|
25
|
+
|
26
|
+
case error
|
27
|
+
when Exceptions::ServiceUnavailableException
|
28
|
+
handled_service_unavailable_exception(error)
|
29
|
+
when Exceptions::ClientException
|
30
|
+
handled_client_exception(error)
|
31
|
+
when Exceptions::TransientException
|
32
|
+
handled_transient_exception(error)
|
33
|
+
else
|
34
|
+
error
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def handled_service_unavailable_exception(e)
|
39
|
+
@error_handler.on_connection_failure(@address)
|
40
|
+
Exceptions::SessionExpiredException("Server at #{@address} is no longer available", e)
|
41
|
+
end
|
42
|
+
|
43
|
+
def handled_transient_exception(e)
|
44
|
+
e.code == "Neo.TransientError.General.DatabaseUnavailable" ? error_handler.on_connection_failure(@address) : e
|
45
|
+
end
|
46
|
+
|
47
|
+
def handled_client_exception(e)
|
48
|
+
return e unless failure_to_write?(e)
|
49
|
+
|
50
|
+
# The server is unaware of the session mode, so we have to implement this logic in the driver.
|
51
|
+
# In the future, we might be able to move this logic to the server.
|
52
|
+
case @access_mode
|
53
|
+
when AccessMode::READ
|
54
|
+
Exceptions::ClientException.new('Write queries cannot be performed in READ access mode.')
|
55
|
+
when AccessMode::WRITE
|
56
|
+
@error_handler.on_write_failure(@address)
|
57
|
+
Exceptions::SessionExpiredException.new('Server at %s no longer accepts writes' % @address)
|
58
|
+
else
|
59
|
+
raise ArgumentError, @accessMode + ' not supported.'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def failure_to_write?(e)
|
64
|
+
%w[Neo.ClientError.Cluster.NotALeader
|
65
|
+
Neo.ClientError.General.ForbiddenOnReadOnlyDatabase].include?(e.code)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Handlers
|
4
|
+
class RunResponseHandler
|
5
|
+
include Spi::ResponseHandler
|
6
|
+
attr_reader :query_keys, :result_available_after, :query_id
|
7
|
+
|
8
|
+
def initialize(metadata_extractor, connection, tx)
|
9
|
+
@query_keys = []
|
10
|
+
@metadata_extractor = metadata_extractor
|
11
|
+
@connection = connection
|
12
|
+
@tx = tx
|
13
|
+
end
|
14
|
+
|
15
|
+
def on_success(metadata)
|
16
|
+
@query_keys = @metadata_extractor.extract_query_keys(metadata)
|
17
|
+
@result_available_after = @metadata_extractor.extract_result_available_after(metadata)
|
18
|
+
@query_id = @metadata_extractor.extract_query_id(metadata)
|
19
|
+
end
|
20
|
+
|
21
|
+
def on_failure(error)
|
22
|
+
if @tx
|
23
|
+
@tx.mark_terminated(error)
|
24
|
+
elsif error.is_a?(Exceptions::AuthorizationExpiredException)
|
25
|
+
connection.terminate_and_release(Exceptions::AuthorizationExpiredException::DESCRIPTION)
|
26
|
+
elsif error.is_a?(Exceptions::ConnectionReadTimeoutException)
|
27
|
+
connection.terminate_and_release(error.message)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def on_record(_fields)
|
32
|
+
raise 'unsupported operation'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Handlers
|
4
|
+
class SessionPullResponseCompletionListener
|
5
|
+
def initialize(connection, bookmark_holder)
|
6
|
+
@connection = connection
|
7
|
+
@bookmark_holder = bookmark_holder
|
8
|
+
end
|
9
|
+
|
10
|
+
def after_success(metadata)
|
11
|
+
release_connection
|
12
|
+
@bookmark_holder.bookmark = Util::MetadataExtractor.extract_bookmarks(metadata)
|
13
|
+
end
|
14
|
+
|
15
|
+
def after_failure(error)
|
16
|
+
case error
|
17
|
+
when Exceptions::AuthorizationExpiredException
|
18
|
+
@connection.terminate_and_release(Exceptions::AuthorizationExpiredException::DESCRIPTION)
|
19
|
+
when Exceptions::ConnectionReadTimeoutException
|
20
|
+
@connection.terminate_and_release(error.message)
|
21
|
+
else
|
22
|
+
release_connection
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def release_connection
|
29
|
+
@connection.release
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Handlers
|
4
|
+
class TransactionPullResponseCompletionListener
|
5
|
+
def initialize(tx)
|
6
|
+
@tx = Validator.require_non_nil!(tx)
|
7
|
+
end
|
8
|
+
|
9
|
+
def after_success(_metadata) end
|
10
|
+
|
11
|
+
def after_failure(error)
|
12
|
+
# always mark transaction as terminated because every error is "acknowledged" with a RESET message
|
13
|
+
# so database forgets about the transaction after the first error
|
14
|
+
# such transaction should not attempt to commit and can be considered as rolled back
|
15
|
+
@tx.mark_terminated(error)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
class ImpersonationUtil
|
4
|
+
IMPERSONATION_UNSUPPORTED_ERROR_MESSAGE = 'Detected connection that does not support impersonation, please make sure to have all servers running 4.4 version or above and communicating over Bolt version 4.4 or above when using impersonation feature'
|
5
|
+
|
6
|
+
def self.ensure_impersonation_support(connection, impersonated_user)
|
7
|
+
if !impersonated_user.nil? && !supports_impersonation?(connection)
|
8
|
+
raise Neo4j::Driver::Exceptions::ClientException, IMPERSONATION_UNSUPPORTED_ERROR_MESSAGE
|
9
|
+
end
|
10
|
+
|
11
|
+
connection
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def self.supports_impersonation?(connection)
|
17
|
+
connection.server_version.greater_than_or_equal(Util::ServerVersion::V4_4_0) &&
|
18
|
+
connection.protocol.version.compare_to( Messaging::V44::BoltProtocolV44::VERSION ) >= 0
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
class InternalBookmark
|
4
|
+
include Bookmark
|
5
|
+
EMPTY = new
|
6
|
+
attr :values
|
7
|
+
delegate :hash, :empty?, to: :values
|
8
|
+
|
9
|
+
private def initialize(*values)
|
10
|
+
@values = values.to_set
|
11
|
+
end
|
12
|
+
|
13
|
+
def eql?(other)
|
14
|
+
values.eql?(other.values)
|
15
|
+
end
|
16
|
+
|
17
|
+
def ==(other)
|
18
|
+
values == other.values
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_s
|
22
|
+
"Bookmark{values=#{values}}"
|
23
|
+
end
|
24
|
+
|
25
|
+
class << self
|
26
|
+
def empty
|
27
|
+
EMPTY
|
28
|
+
end
|
29
|
+
|
30
|
+
def from(*bookmarks)
|
31
|
+
new(*bookmarks.reduce(Set.new) { |set, bookmark| set + bookmark.values })
|
32
|
+
end
|
33
|
+
|
34
|
+
alias parse new
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|