neo4j-ruby-driver 1.7.5 → 4.4.0.alpha.2
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 +5 -3
- 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_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 +27 -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 +28 -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 +34 -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 +26 -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/{lib → ruby}/neo4j/driver/version.rb +1 -1
- data/ruby/neo4j/driver.rb +30 -0
- metadata +267 -92
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 698039b3b9cd2cf99a79e5a96f23ad4be85aabe2dbf85274b01ec8bf05301658
|
4
|
+
data.tar.gz: cf29ed98589d4e6aac9469d67d3e069696091612d9a0fd8eef2e3993f2ef9a4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f2beecb1b73d3394f3ea6259c4664b7aa0400472edba1aafdc02a0b5932cd90e1e5ff2bf8319e6931c341b9e74a0037d4727ceffc4e29138f188fa373aee4b0
|
7
|
+
data.tar.gz: 673f97b1c0eed87beea9f0c1538eb96fe34ff92fdd9b49ef82c9dc9e54b49b0197c98e578ea399023b3b1579774e474d3019527c67ed7a62b5251fdeff078f23
|
data/README.md
CHANGED
@@ -3,37 +3,11 @@
|
|
3
3
|
home :: https://github.com/neo4jrb/neo4j-ruby-driver
|
4
4
|
|
5
5
|
This repository contains 2 implementation of a neo4j driver for ruby:
|
6
|
-
-
|
7
|
-
-
|
6
|
+
- based on official java implementation. It provides a thin wrapper over the java driver (only on jruby).
|
7
|
+
- pure ruby implmementation. Available on all ruby versions >= 3.1.
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
11
|
-
### neo4j-java-driver
|
12
|
-
|
13
|
-
Add this line to your application's Gemfile:
|
14
|
-
|
15
|
-
```ruby
|
16
|
-
gem 'neo4j-java-driver'
|
17
|
-
```
|
18
|
-
|
19
|
-
And then execute:
|
20
|
-
|
21
|
-
$ bundle
|
22
|
-
|
23
|
-
Or install it yourself as:
|
24
|
-
|
25
|
-
$ gem install neo4j-java-driver
|
26
|
-
|
27
|
-
### neo4j-ruby-driver
|
28
|
-
|
29
|
-
As a prerequisite seabolt must be installed.
|
30
|
-
|
31
|
-
On macOS
|
32
|
-
|
33
|
-
$ brew install michael-simons/homebrew-seabolt/seabolt
|
34
|
-
|
35
|
-
On other systems please follow the instructions to install [seabolt](https://github.com/neo4j-drivers/seabolt) either from package or source. Make sure the libseabolt17 ends up in a system lib path e.g. /usr/local/lib
|
36
|
-
|
37
11
|
Add this line to your application's Gemfile:
|
38
12
|
|
39
13
|
```ruby
|
@@ -48,22 +22,20 @@ Or install it yourself as:
|
|
48
22
|
|
49
23
|
$ gem install neo4j-ruby-driver
|
50
24
|
|
51
|
-
##
|
25
|
+
## Server Compatibility
|
52
26
|
|
53
|
-
|
54
|
-
At this moment [The Neo4j Drivers Manual v1.7](https://neo4j.com/docs/driver-manual/1.7/) along with the ruby version of the [code fragments](https://github.com/neo4jrb/neo4j-ruby-driver/blob/master/docs/dev_manual_examples.rb) and the ruby specs provide the only documentation.
|
27
|
+
The compatibility with Neo4j Server versions is documented in the [Neo4j Knowledge Base](https://neo4j.com/developer/kb/neo4j-supported-versions/).
|
55
28
|
|
56
|
-
|
29
|
+
## Usage
|
57
30
|
|
58
|
-
|
31
|
+
The API is to highest possible degree consistent with the official java driver.
|
32
|
+
At this moment [The Neo4j Drivers Manual v4.4](https://neo4j.com/docs/java-manual/current/) along with the ruby version of the [code fragments](https://github.com/neo4jrb/neo4j-ruby-driver/blob/master/docs/dev_manual_examples.rb) and the ruby specs provide the only documentation.
|
59
33
|
|
60
|
-
|
34
|
+
[Neo4j Java Driver 4.3 API](https://neo4j.com/docs/api/java-driver/current/) can be helpful as well..
|
61
35
|
|
62
|
-
|
36
|
+
## Development
|
63
37
|
|
64
|
-
|
65
|
-
|
66
|
-
FFI based same as above but with driver variable set:
|
38
|
+
This gem includes 2 different implementations: java driver wrapper and pure ruby driver
|
67
39
|
|
68
40
|
$ bin/setup
|
69
41
|
|
@@ -73,10 +45,22 @@ To run the tests the following tools need to be installed:
|
|
73
45
|
|
74
46
|
$ brew install python
|
75
47
|
$ pip3 install --user git+https://github.com/klobuczek/boltkit@1.3#egg=boltkit
|
76
|
-
$ neoctrl-install -e 4.
|
77
|
-
$ neoctrl-configure servers/neo4j-enterprise-4.
|
78
|
-
$ neoctrl-set-initial-password
|
79
|
-
$ neoctrl-start servers/neo4j-enterprise-4.
|
48
|
+
$ neoctrl-install -e 4.4.5 servers
|
49
|
+
$ neoctrl-configure servers/neo4j-enterprise-4.4.5 dbms.directories.import= dbms.default_listen_address=::
|
50
|
+
$ neoctrl-set-initial-password pass servers/neo4j-enterprise-4.4.5
|
51
|
+
$ neoctrl-start servers/neo4j-enterprise-4.4.5
|
52
|
+
|
53
|
+
To run the tests:
|
54
|
+
```console
|
55
|
+
$ bin/setup
|
56
|
+
$ rspec spec
|
57
|
+
```
|
58
|
+
|
59
|
+
In case of heap space memory error (`org.neo4j.driver.exceptions.DatabaseException: Java heap space`), you should limit the dbms memory, for example:
|
60
|
+
|
61
|
+
```console
|
62
|
+
$ neoctrl-configure servers/neo4j-enterprise-4.4.5 dbms.memory.pagecache.size=600m dbms.memory.heap.max_size=600m dbms.memory.heap.initial_size=600m dbms.directories.import= dbms.connectors.default_listen_address=::
|
63
|
+
```
|
80
64
|
|
81
65
|
## Contributing
|
82
66
|
|
data/lib/loader.rb
CHANGED
@@ -7,11 +7,13 @@ class Loader
|
|
7
7
|
loader = Zeitwerk::Loader.new
|
8
8
|
loader.tag = 'neo4j-ruby-driver'
|
9
9
|
loader.push_dir(File.expand_path(__dir__))
|
10
|
-
|
11
|
-
loader.
|
10
|
+
driver_specific_dir = File.dirname(File.dirname(caller_locations(1..1).first.path))
|
11
|
+
loader.push_dir(driver_specific_dir)
|
12
|
+
yield loader if block_given?
|
13
|
+
loader.ignore(File.expand_path('neo4j-*-driver_jars.rb', __dir__))
|
12
14
|
loader.ignore(File.expand_path('neo4j_ruby_driver.rb', __dir__))
|
13
15
|
loader.ignore(File.expand_path('org', __dir__))
|
14
|
-
loader.inflector = Zeitwerk::GemInflector.new(File.expand_path('neo4j/driver',
|
16
|
+
loader.inflector = Zeitwerk::GemInflector.new(File.expand_path('neo4j/driver', driver_specific_dir))
|
15
17
|
loader.setup
|
16
18
|
loader.eager_load
|
17
19
|
end
|
@@ -12,8 +12,8 @@ module Neo4j
|
|
12
12
|
def with_block_definer(methods)
|
13
13
|
Module.new do
|
14
14
|
methods.each do |method|
|
15
|
-
define_method(method) do |*args, &block|
|
16
|
-
closable = super(*args)
|
15
|
+
define_method(method) do |*args, **kwargs, &block|
|
16
|
+
closable = super(*args, **kwargs)
|
17
17
|
if block
|
18
18
|
begin
|
19
19
|
block.arity.zero? ? closable.instance_eval(&block) : block.call(closable)
|
@@ -3,7 +3,12 @@
|
|
3
3
|
module Neo4j
|
4
4
|
module Driver
|
5
5
|
module Exceptions
|
6
|
-
|
6
|
+
# Failed to authenticate the driver to the server due to bad credentials provided.
|
7
|
+
# When this error happens, the error could be recovered by closing the current driver and restart a new driver with
|
8
|
+
# the correct credentials.
|
9
|
+
|
10
|
+
# @since 1.1
|
11
|
+
class AuthenticationException < SecurityException
|
7
12
|
end
|
8
13
|
end
|
9
14
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j
|
4
|
+
module Driver
|
5
|
+
module Exceptions
|
6
|
+
# The authorization info maintained on the server has expired. The client should reconnect.
|
7
|
+
# <p>
|
8
|
+
# Error code: Neo.ClientError.Security.AuthorizationExpired
|
9
|
+
class AuthorizationExpiredException < SecurityException
|
10
|
+
DESCRIPTION = 'Authorization information kept on the server has expired, this connection is no longer valid.'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -3,6 +3,9 @@
|
|
3
3
|
module Neo4j
|
4
4
|
module Driver
|
5
5
|
module Exceptions
|
6
|
+
# A <em>ClientException</em> indicates that the client has carried out an operation incorrectly.
|
7
|
+
# The error code provided can be used to determine further detail for the problem.
|
8
|
+
# @since 1.0
|
6
9
|
class ClientException < Neo4jException
|
7
10
|
class << self
|
8
11
|
def unable_to_convert(object)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j
|
4
|
+
module Driver
|
5
|
+
module Exceptions
|
6
|
+
# Indicates that read timed out due to it taking longer than the server-supplied timeout value via the {@code connection.recv_timeout_seconds} configuration
|
7
|
+
# hint. The server might provide this value to clients to let them know when a given connection may be considered broken if client does not get any
|
8
|
+
# communication from the server within the specified timeout period. This results in the server being removed from the routing table.
|
9
|
+
class ConnectionReadTimeoutException < ServiceUnavailableException
|
10
|
+
INSTANCE = new('Connection read timed out due to it taking longer than the server-supplied timeout value via configuration hint.')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -3,6 +3,9 @@
|
|
3
3
|
module Neo4j
|
4
4
|
module Driver
|
5
5
|
module Exceptions
|
6
|
+
# A <em>DatabaseException</em> indicates that there is a problem within the underlying database.
|
7
|
+
# The error code provided can be used to determine further detail for the problem.
|
8
|
+
# @since 1.0
|
6
9
|
class DatabaseException < Neo4jException
|
7
10
|
end
|
8
11
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j
|
4
|
+
module Driver
|
5
|
+
module Exceptions
|
6
|
+
# An error has happened while getting routing table with a remote server.
|
7
|
+
# While this error is not fatal and we might be able to recover if we continue trying on another server.
|
8
|
+
# If we fail to get a valid routing table from all routing servers known to this driver,
|
9
|
+
# then we will end up with a fatal error {@link ServiceUnavailableException}.
|
10
|
+
|
11
|
+
# If you see this error in your logs, it is safe to ignore if your cluster is temporarily changing structure during that time.
|
12
|
+
class DiscoveryException < Neo4jException
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j
|
4
|
+
module Driver
|
5
|
+
module Exceptions
|
6
|
+
# This error indicate a fatal problem to obtain routing tables such as the routing table for a specified database does not exist.
|
7
|
+
# This exception should not be retried.
|
8
|
+
# @since 4.0
|
9
|
+
class FatalDiscoveryException < ClientException
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -3,7 +3,14 @@
|
|
3
3
|
module Neo4j
|
4
4
|
module Driver
|
5
5
|
module Exceptions
|
6
|
+
# A signal that the contract for client-server communication has broken down.
|
7
|
+
# The user should contact support and cannot resolve this his or herself.
|
6
8
|
class ProtocolException < Neo4jException
|
9
|
+
CODE = "Protocol violation: "
|
10
|
+
|
11
|
+
def initialize(message, e)
|
12
|
+
super("#{CODE}message", e)
|
13
|
+
end
|
7
14
|
end
|
8
15
|
end
|
9
16
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j
|
4
|
+
module Driver
|
5
|
+
module Exceptions
|
6
|
+
# A user is trying to access resources that are no longer valid due to
|
7
|
+
# the resources have already been consumed or
|
8
|
+
# the {@link QueryRunner} where the resources are created has already been closed.
|
9
|
+
class ResultConsumedException < ClientException
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -3,7 +3,11 @@
|
|
3
3
|
module Neo4j
|
4
4
|
module Driver
|
5
5
|
module Exceptions
|
6
|
-
|
6
|
+
# Failed to communicate with the server due to security errors.
|
7
|
+
# When this type of error happens, the security cause of the error should be fixed to ensure the safety of your data.
|
8
|
+
# Restart of server/driver/cluster might be required to recover from this error.
|
9
|
+
# @since 1.1
|
10
|
+
class SecurityException < ClientException
|
7
11
|
end
|
8
12
|
end
|
9
13
|
end
|
@@ -3,6 +3,10 @@
|
|
3
3
|
module Neo4j
|
4
4
|
module Driver
|
5
5
|
module Exceptions
|
6
|
+
# A <em>SessionExpiredException</em> indicates that the session can no longer satisfy the criteria under which it
|
7
|
+
# was acquired, e.g. a server no longer accepts write requests. A new session needs to be acquired from the driver
|
8
|
+
# and all actions taken on the expired session must be replayed.
|
9
|
+
# @since 1.1
|
6
10
|
class SessionExpiredException < Neo4jException
|
7
11
|
end
|
8
12
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j
|
4
|
+
module Driver
|
5
|
+
module Exceptions
|
6
|
+
# The provided token has expired.
|
7
|
+
# <p>
|
8
|
+
# The current driver instance is considered invalid. It should not be used anymore. The client must create a new driver instance with a valid token.
|
9
|
+
# <p>
|
10
|
+
# Error code: Neo.ClientError.Security.TokenExpired
|
11
|
+
class TokenExpiredException < SecurityException
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j
|
4
|
+
module Driver
|
5
|
+
module Exceptions
|
6
|
+
# This exception indicates a user is nesting new transaction with an on-going transaction (unmanaged and/or auto-commit).
|
7
|
+
class TransactionNestingException < ClientException
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -3,6 +3,9 @@
|
|
3
3
|
module Neo4j
|
4
4
|
module Driver
|
5
5
|
module Exceptions
|
6
|
+
# A <em>TransientException</em> signals a temporary fault that may be worked around by retrying.
|
7
|
+
# The error code provided can be used to determine further detail for the problem.
|
8
|
+
# @since 1.0
|
6
9
|
class TransientException < Neo4jException
|
7
10
|
end
|
8
11
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Neo4j
|
2
|
+
module Driver
|
3
|
+
module Exceptions
|
4
|
+
module Value
|
5
|
+
# A <em>LossyCoercion</em> exception indicates that the conversion cannot be achieved without losing precision.
|
6
|
+
# @since 1.0
|
7
|
+
class LossyCoercion < ValueException
|
8
|
+
def initialize(source_type_name, destination_type_name)
|
9
|
+
super("Cannot coerce #{source_type_name} to #{destination_type_name} without losing precision")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Neo4j
|
2
|
+
module Driver
|
3
|
+
module Exceptions
|
4
|
+
module Value
|
5
|
+
# A <em>NotMultiValued</em> exception indicates that the value does not consist of multiple values, a.k.a. not a map
|
6
|
+
# or array.
|
7
|
+
# @since 1.0
|
8
|
+
class NotMultiValued < ValueException
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Neo4j
|
2
|
+
module Driver
|
3
|
+
module Exceptions
|
4
|
+
module Value
|
5
|
+
# A <em>Uncoercible</em> exception indicates that the conversion cannot be achieved.
|
6
|
+
# @since 1.0
|
7
|
+
class Uncoercible < ValueException
|
8
|
+
def initialize(source_type_name, destination_type_name)
|
9
|
+
super("Cannot coerce #{source_type_name} to #{destination_type_name}")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Neo4j
|
2
|
+
module Driver
|
3
|
+
module Exceptions
|
4
|
+
module Value
|
5
|
+
# A <em>ValueException</em> indicates that the client has carried out an operation on values incorrectly.
|
6
|
+
# @since 1.0
|
7
|
+
class ValueException < ClientException
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
# Holds a host and port pair that denotes a Bolt server address.
|
4
|
+
class BoltServerAddress
|
5
|
+
attr_reader :host, :connection_host, :port
|
6
|
+
delegate :hash, to: :attributes
|
7
|
+
|
8
|
+
DEFAULT_PORT = 7687
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def host_from(uri)
|
12
|
+
uri&.host || (raise invalid_address_format(uri))
|
13
|
+
end
|
14
|
+
|
15
|
+
def port_from(uri)
|
16
|
+
uri&.port || DEFAULT_PORT
|
17
|
+
end
|
18
|
+
|
19
|
+
def uri_from(address)
|
20
|
+
scheme_split = address.split('://')
|
21
|
+
|
22
|
+
if scheme_split.length == 1
|
23
|
+
# URI can't parse addresses without scheme, prepend fake "bolt://" to reuse the parsing facility
|
24
|
+
scheme = 'bolt://'
|
25
|
+
host_port = host_port_from(scheme_split.first)
|
26
|
+
elsif scheme_split.length == 2
|
27
|
+
scheme = "#{scheme_split.first}://"
|
28
|
+
host_port = host_port_from(scheme_split.second)
|
29
|
+
else
|
30
|
+
raise invalid_address_format(address)
|
31
|
+
end
|
32
|
+
|
33
|
+
URI(scheme + host_port)
|
34
|
+
end
|
35
|
+
|
36
|
+
def host_port_from(address)
|
37
|
+
# expected to be an IPv6 address like [::1] or [::1]:7687
|
38
|
+
return address if address.start_with?('[')
|
39
|
+
|
40
|
+
contains_single_colon = address.index(':') == address.rindex(':')
|
41
|
+
|
42
|
+
# expected to be an IPv4 address with or without port like 127.0.0.1 or 127.0.0.1:7687
|
43
|
+
return address if contains_single_colon
|
44
|
+
|
45
|
+
# address contains multiple colons and does not start with '['
|
46
|
+
# expected to be an IPv6 address without brackets
|
47
|
+
"[#{address}]"
|
48
|
+
end
|
49
|
+
|
50
|
+
def invalid_address_format(address)
|
51
|
+
ArgumentError.new("Invalid address format #{address}")
|
52
|
+
end
|
53
|
+
|
54
|
+
def require_valid_port(port)
|
55
|
+
return port if port >= 0 && port <= 65_535
|
56
|
+
|
57
|
+
raise ArgumentError, "Illegal port: #{port}"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def initialize(uri: nil, host: self.class.host_from(uri), port: self.class.port_from(uri), connection_host: host)
|
62
|
+
@host = Validator.require_non_nil!(host)
|
63
|
+
@connection_host = Validator.require_non_nil!(connection_host)
|
64
|
+
@port = self.class.require_valid_port(port)
|
65
|
+
end
|
66
|
+
|
67
|
+
LOCAL_DEFAULT = new(host: 'localhost', port: DEFAULT_PORT)
|
68
|
+
|
69
|
+
def self.from(address)
|
70
|
+
address.is_a?(BoltServerAddress) ? address : new(address.host, address.port)
|
71
|
+
end
|
72
|
+
|
73
|
+
def eql?(other)
|
74
|
+
attributes.eql?(other&.attributes)
|
75
|
+
end
|
76
|
+
|
77
|
+
def to_s
|
78
|
+
"#{host}#{"(#{connection_host})" unless host == connection_host}:#{port}"
|
79
|
+
end
|
80
|
+
|
81
|
+
# Create a stream of unicast addresses.
|
82
|
+
# <p>
|
83
|
+
# While this implementation just returns a stream of itself, the subclasses may provide multiple addresses.
|
84
|
+
|
85
|
+
# @return stream of unicast addresses.
|
86
|
+
def unicast_stream
|
87
|
+
[self]
|
88
|
+
end
|
89
|
+
|
90
|
+
private
|
91
|
+
|
92
|
+
def attributes
|
93
|
+
[@host, @connection_host, @port]
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -14,13 +14,14 @@ module Neo4j
|
|
14
14
|
raise(ArgumentError, yield) unless obj.nil? || obj.is_a?(Hash)
|
15
15
|
end
|
16
16
|
|
17
|
-
def self.require_non_nil!(obj, message)
|
18
|
-
raise ArgumentError, message if obj.nil?
|
17
|
+
def self.require_non_nil!(obj, message = nil)
|
18
|
+
raise ArgumentError, [message, "can't be nil"].compact.join(' ') if obj.nil?
|
19
|
+
obj
|
19
20
|
end
|
20
21
|
|
21
22
|
def self.require_non_nil_credentials!(username, password)
|
22
|
-
require_non_nil! username, "Username
|
23
|
-
require_non_nil! password, "Password
|
23
|
+
require_non_nil! username, "Username"
|
24
|
+
require_non_nil! password, "Password"
|
24
25
|
end
|
25
26
|
end
|
26
27
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neo4j
|
4
|
+
module Driver
|
5
|
+
module Synchronizable
|
6
|
+
def sync(*methods)
|
7
|
+
prepend with_sync_wrapper(methods)
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def with_sync_wrapper(methods)
|
13
|
+
Module.new do
|
14
|
+
methods.each do |method|
|
15
|
+
define_method(method) do |*args, **kwargs, &block|
|
16
|
+
Sync { super(*args, **kwargs, &block) }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/neo4j_ruby_driver.rb
CHANGED
@@ -1,20 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
module Neo4j
|
6
|
-
module Driver
|
7
|
-
module Exceptions
|
8
|
-
end
|
9
|
-
module Internal
|
10
|
-
end
|
11
|
-
end
|
3
|
+
module Neo4j
|
4
|
+
module Driver
|
12
5
|
end
|
13
6
|
end
|
14
|
-
# End workaround
|
15
7
|
|
8
|
+
require 'active_support/concern'
|
16
9
|
require 'active_support/core_ext/hash/indifferent_access'
|
10
|
+
require 'active_support/isolated_execution_state' if Gem::Requirement.create('>= 7').satisfied_by?(Gem.loaded_specs["activesupport"].version) # TODO: this should not be necessary https://github.com/rails/rails/issues/43851
|
17
11
|
require 'active_support/core_ext/numeric/time'
|
18
12
|
require 'active_support/duration'
|
19
13
|
require 'active_support/time'
|
20
14
|
require 'neo4j/driver'
|
15
|
+
require 'uri'
|