neo4j-ruby-driver 5.7.0.alpha.4 → 6.0.3.alpha.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +440 -40
- data/jruby/neo4j/driver/ext/async_converter.rb +55 -0
- data/jruby/neo4j/driver/ext/auth_tokens.rb +20 -0
- data/jruby/neo4j/driver/ext/config_converter.rb +83 -0
- data/jruby/neo4j/driver/ext/exception_checkable.rb +34 -0
- data/jruby/neo4j/driver/ext/exception_mapper.rb +92 -0
- data/jruby/neo4j/driver/ext/graph_database.rb +33 -0
- data/jruby/neo4j/driver/ext/internal/abstract_query_runner.rb +18 -0
- data/jruby/neo4j/driver/ext/internal/async/internal_async_session.rb +23 -0
- data/jruby/neo4j/driver/ext/internal/cluster/routing_table_registry_impl.rb +15 -0
- data/jruby/neo4j/driver/ext/internal/cursor/disposable_async_result_cursor.rb +15 -0
- data/jruby/neo4j/driver/ext/internal/driver_factory.rb +24 -0
- data/jruby/neo4j/driver/ext/internal/eager_result_value.rb +17 -0
- data/jruby/neo4j/driver/ext/internal/metrics/internal_connection_pool_metrics.rb +17 -0
- data/jruby/neo4j/driver/ext/internal/summary/internal_notification.rb +27 -0
- data/jruby/neo4j/driver/ext/internal/summary/internal_plan.rb +26 -0
- data/jruby/neo4j/driver/ext/internal/summary/internal_result_summary.rb +34 -0
- data/jruby/neo4j/driver/ext/internal_driver.rb +52 -0
- data/jruby/neo4j/driver/ext/internal_entity.rb +21 -0
- data/jruby/neo4j/driver/ext/internal_keys.rb +15 -0
- data/jruby/neo4j/driver/ext/internal_node.rb +13 -0
- data/jruby/neo4j/driver/ext/internal_record.rb +29 -0
- data/jruby/neo4j/driver/ext/internal_relationship.rb +13 -0
- data/jruby/neo4j/driver/ext/internal_result.rb +27 -0
- data/jruby/neo4j/driver/ext/internal_session.rb +44 -0
- data/jruby/neo4j/driver/ext/internal_transaction.rb +19 -0
- data/jruby/neo4j/driver/ext/logger.rb +60 -0
- data/jruby/neo4j/driver/ext/map_converter.rb +14 -0
- data/jruby/neo4j/driver/ext/neo_converter.rb +59 -0
- data/jruby/neo4j/driver/ext/query.rb +13 -0
- data/jruby/neo4j/driver/ext/ruby_converter.rb +57 -0
- data/jruby/neo4j/driver/ext/run_override.rb +22 -0
- data/jruby/neo4j/driver/ext/start_end_naming.rb +17 -0
- data/{ruby → jruby}/neo4j/driver/version.rb +1 -1
- data/jruby/neo4j/driver.rb +62 -0
- data/lib/neo4j/driver/{auto_closable.rb → auto_closeable.rb} +6 -6
- data/lib/neo4j/driver/exceptions/neo4j_exception.rb +6 -6
- data/lib/neo4j/driver/internal/deprecator.rb +15 -0
- metadata +91 -277
- data/ruby/neo4j/driver/access_mode.rb +0 -10
- data/ruby/neo4j/driver/auth_tokens.rb +0 -34
- data/ruby/neo4j/driver/bookmark.rb +0 -21
- data/ruby/neo4j/driver/config.rb +0 -89
- data/ruby/neo4j/driver/graph_database.rb +0 -78
- data/ruby/neo4j/driver/internal/async/connection/bolt_protocol_util.rb +0 -51
- data/ruby/neo4j/driver/internal/async/connection/bootstrap_factory.rb +0 -22
- data/ruby/neo4j/driver/internal/async/connection/channel_attributes.rb +0 -31
- data/ruby/neo4j/driver/internal/async/connection/channel_connected_listener.rb +0 -32
- data/ruby/neo4j/driver/internal/async/connection/channel_connector_impl.rb +0 -83
- data/ruby/neo4j/driver/internal/async/connection/channel_pipeline_builder_impl.rb +0 -22
- data/ruby/neo4j/driver/internal/async/connection/direct_connection.rb +0 -30
- data/ruby/neo4j/driver/internal/async/connection/event_loop_group_factory.rb +0 -83
- data/ruby/neo4j/driver/internal/async/connection/handshake_completed_listener.rb +0 -27
- data/ruby/neo4j/driver/internal/async/connection/handshake_handler.rb +0 -113
- data/ruby/neo4j/driver/internal/async/connection/netty_channel_initializer.rb +0 -57
- data/ruby/neo4j/driver/internal/async/connection/netty_domain_name_resolver.rb +0 -26
- data/ruby/neo4j/driver/internal/async/connection/netty_domain_name_resolver_group.rb +0 -19
- data/ruby/neo4j/driver/internal/async/connection/routing_connection.rb +0 -36
- data/ruby/neo4j/driver/internal/async/connection/stream.rb +0 -12
- data/ruby/neo4j/driver/internal/async/connection/stream_reader.rb +0 -16
- data/ruby/neo4j/driver/internal/async/connection_context.rb +0 -10
- data/ruby/neo4j/driver/internal/async/immutable_connection_context.rb +0 -24
- data/ruby/neo4j/driver/internal/async/inbound/byte_buf_input.rb +0 -30
- data/ruby/neo4j/driver/internal/async/inbound/channel_error_handler.rb +0 -77
- data/ruby/neo4j/driver/internal/async/inbound/chunk_decoder.rb +0 -41
- data/ruby/neo4j/driver/internal/async/inbound/connect_timeout_handler.rb +0 -32
- data/ruby/neo4j/driver/internal/async/inbound/connection_read_timeout_handler.rb +0 -17
- data/ruby/neo4j/driver/internal/async/inbound/inbound_message_dispatcher.rb +0 -171
- data/ruby/neo4j/driver/internal/async/inbound/inbound_message_handler.rb +0 -42
- data/ruby/neo4j/driver/internal/async/inbound/message_decoder.rb +0 -51
- data/ruby/neo4j/driver/internal/async/internal_async_session.rb +0 -98
- data/ruby/neo4j/driver/internal/async/internal_async_transaction.rb +0 -13
- data/ruby/neo4j/driver/internal/async/leak_logging_network_session.rb +0 -34
- data/ruby/neo4j/driver/internal/async/network_connection.rb +0 -194
- data/ruby/neo4j/driver/internal/async/network_session.rb +0 -150
- data/ruby/neo4j/driver/internal/async/outbound/chunk_aware_byte_buf_output.rb +0 -110
- data/ruby/neo4j/driver/internal/async/outbound/outbound_message_handler.rb +0 -39
- data/ruby/neo4j/driver/internal/async/pool/channel.rb +0 -66
- data/ruby/neo4j/driver/internal/async/pool/channel_pool.rb +0 -31
- data/ruby/neo4j/driver/internal/async/pool/channel_tracker.rb +0 -135
- data/ruby/neo4j/driver/internal/async/pool/connection_pool_impl.rb +0 -156
- data/ruby/neo4j/driver/internal/async/pool/netty_channel_health_checker.rb +0 -87
- data/ruby/neo4j/driver/internal/async/pool/netty_channel_pool.rb +0 -52
- data/ruby/neo4j/driver/internal/async/pool/network_connection_factory.rb +0 -21
- data/ruby/neo4j/driver/internal/async/pool/pool_settings.rb +0 -34
- data/ruby/neo4j/driver/internal/async/pool/timed_stack.rb +0 -15
- data/ruby/neo4j/driver/internal/async/result_cursors_holder.rb +0 -17
- data/ruby/neo4j/driver/internal/async/unmanaged_transaction.rb +0 -212
- data/ruby/neo4j/driver/internal/bookmark_holder.rb +0 -9
- data/ruby/neo4j/driver/internal/cluster/cluster_composition.rb +0 -48
- data/ruby/neo4j/driver/internal/cluster/cluster_composition_lookup_result.rb +0 -14
- data/ruby/neo4j/driver/internal/cluster/cluster_routing_table.rb +0 -122
- data/ruby/neo4j/driver/internal/cluster/identity_resolver.rb +0 -10
- data/ruby/neo4j/driver/internal/cluster/loadbalancing/least_connected_load_balancing_strategy.rb +0 -68
- data/ruby/neo4j/driver/internal/cluster/loadbalancing/load_balancer.rb +0 -125
- data/ruby/neo4j/driver/internal/cluster/loadbalancing/round_robin_array_index.rb +0 -13
- data/ruby/neo4j/driver/internal/cluster/multi_databases_routing_procedure_runner.rb +0 -31
- data/ruby/neo4j/driver/internal/cluster/rediscovery_impl.rb +0 -147
- data/ruby/neo4j/driver/internal/cluster/route_message_routing_procedure_runner.rb +0 -43
- data/ruby/neo4j/driver/internal/cluster/routing_context.rb +0 -77
- data/ruby/neo4j/driver/internal/cluster/routing_procedure_cluster_composition_provider.rb +0 -60
- data/ruby/neo4j/driver/internal/cluster/routing_procedure_response.rb +0 -35
- data/ruby/neo4j/driver/internal/cluster/routing_settings.rb +0 -24
- data/ruby/neo4j/driver/internal/cluster/routing_table_handler_impl.rb +0 -95
- data/ruby/neo4j/driver/internal/cluster/routing_table_registry_impl.rb +0 -121
- data/ruby/neo4j/driver/internal/cluster/single_database_routing_procedure_runner.rb +0 -73
- data/ruby/neo4j/driver/internal/connection_settings.rb +0 -16
- data/ruby/neo4j/driver/internal/cursor/async_result_cursor_impl.rb +0 -55
- data/ruby/neo4j/driver/internal/cursor/async_result_cursor_only_factory.rb +0 -24
- data/ruby/neo4j/driver/internal/cursor/disposable_async_result_cursor.rb +0 -61
- data/ruby/neo4j/driver/internal/cursor/result_cursor_factory_impl.rb +0 -24
- data/ruby/neo4j/driver/internal/cursor/rx_result_cursor_impl.rb +0 -110
- data/ruby/neo4j/driver/internal/database_name_util.rb +0 -37
- data/ruby/neo4j/driver/internal/default_bookmark_holder.rb +0 -9
- data/ruby/neo4j/driver/internal/default_domain_name_resolver.rb +0 -11
- data/ruby/neo4j/driver/internal/direct_connection_provider.rb +0 -40
- data/ruby/neo4j/driver/internal/driver_factory.rb +0 -126
- data/ruby/neo4j/driver/internal/handlers/begin_tx_response_handler.rb +0 -20
- data/ruby/neo4j/driver/internal/handlers/channel_releasing_reset_response_handler.rb +0 -30
- data/ruby/neo4j/driver/internal/handlers/commit_tx_response_handler.rb +0 -25
- data/ruby/neo4j/driver/internal/handlers/hello_response_handler.rb +0 -65
- data/ruby/neo4j/driver/internal/handlers/init_response_handler.rb +0 -34
- data/ruby/neo4j/driver/internal/handlers/legacy_pull_all_response_handler.rb +0 -199
- data/ruby/neo4j/driver/internal/handlers/no_op_response_handler.rb +0 -16
- data/ruby/neo4j/driver/internal/handlers/ping_response_handler.rb +0 -29
- data/ruby/neo4j/driver/internal/handlers/pull_handlers.rb +0 -32
- data/ruby/neo4j/driver/internal/handlers/pulln/auto_pull_response_handler.rb +0 -168
- data/ruby/neo4j/driver/internal/handlers/pulln/basic_pull_response_handler.rb +0 -298
- data/ruby/neo4j/driver/internal/handlers/pulln/fetch_size_util.rb +0 -20
- data/ruby/neo4j/driver/internal/handlers/reset_response_handler.rb +0 -34
- data/ruby/neo4j/driver/internal/handlers/rollback_tx_response_handler.rb +0 -25
- data/ruby/neo4j/driver/internal/handlers/route_message_response_handler.rb +0 -21
- data/ruby/neo4j/driver/internal/handlers/routing_response_handler.rb +0 -70
- data/ruby/neo4j/driver/internal/handlers/run_response_handler.rb +0 -38
- data/ruby/neo4j/driver/internal/handlers/session_pull_response_completion_listener.rb +0 -34
- data/ruby/neo4j/driver/internal/handlers/transaction_pull_response_completion_listener.rb +0 -20
- data/ruby/neo4j/driver/internal/impersonation_util.rb +0 -22
- data/ruby/neo4j/driver/internal/internal_bookmark.rb +0 -36
- data/ruby/neo4j/driver/internal/internal_database_name.rb +0 -9
- data/ruby/neo4j/driver/internal/internal_driver.rb +0 -74
- data/ruby/neo4j/driver/internal/internal_entity.rb +0 -21
- data/ruby/neo4j/driver/internal/internal_node.rb +0 -21
- data/ruby/neo4j/driver/internal/internal_pair.rb +0 -9
- data/ruby/neo4j/driver/internal/internal_path.rb +0 -35
- data/ruby/neo4j/driver/internal/internal_point2_d.rb +0 -9
- data/ruby/neo4j/driver/internal/internal_point3_d.rb +0 -6
- data/ruby/neo4j/driver/internal/internal_record.rb +0 -27
- data/ruby/neo4j/driver/internal/internal_relationship.rb +0 -27
- data/ruby/neo4j/driver/internal/internal_result.rb +0 -49
- data/ruby/neo4j/driver/internal/internal_session.rb +0 -81
- data/ruby/neo4j/driver/internal/internal_transaction.rb +0 -48
- data/ruby/neo4j/driver/internal/logging/channel_activity_logger.rb +0 -29
- data/ruby/neo4j/driver/internal/logging/channel_error_logger.rb +0 -17
- data/ruby/neo4j/driver/internal/logging/prefixed_logger.rb +0 -19
- data/ruby/neo4j/driver/internal/logging/reformatted_logger.rb +0 -17
- data/ruby/neo4j/driver/internal/messaging/abstract_message_writer.rb +0 -23
- data/ruby/neo4j/driver/internal/messaging/bolt_protocol.rb +0 -32
- data/ruby/neo4j/driver/internal/messaging/bolt_protocol_version.rb +0 -48
- data/ruby/neo4j/driver/internal/messaging/common/common_message_reader.rb +0 -51
- data/ruby/neo4j/driver/internal/messaging/common/common_value.rb +0 -33
- data/ruby/neo4j/driver/internal/messaging/common/common_value_packer.rb +0 -104
- data/ruby/neo4j/driver/internal/messaging/common/common_value_unpacker.rb +0 -256
- data/ruby/neo4j/driver/internal/messaging/encode/begin_message_encoder.rb +0 -15
- data/ruby/neo4j/driver/internal/messaging/encode/commit_message_encoder.rb +0 -14
- data/ruby/neo4j/driver/internal/messaging/encode/discard_all_message_encoder.rb +0 -14
- data/ruby/neo4j/driver/internal/messaging/encode/discard_message_encoder.rb +0 -15
- data/ruby/neo4j/driver/internal/messaging/encode/goodbye_message_encoder.rb +0 -14
- data/ruby/neo4j/driver/internal/messaging/encode/hello_message_encoder.rb +0 -15
- data/ruby/neo4j/driver/internal/messaging/encode/init_message_encoder.rb +0 -16
- data/ruby/neo4j/driver/internal/messaging/encode/logoff_message_encoder.rb +0 -14
- data/ruby/neo4j/driver/internal/messaging/encode/logon_message_encoder.rb +0 -15
- data/ruby/neo4j/driver/internal/messaging/encode/pull_all_message_encoder.rb +0 -14
- data/ruby/neo4j/driver/internal/messaging/encode/pull_message_encoder.rb +0 -15
- data/ruby/neo4j/driver/internal/messaging/encode/reset_message_encoder.rb +0 -14
- data/ruby/neo4j/driver/internal/messaging/encode/rollback_message_encoder.rb +0 -14
- data/ruby/neo4j/driver/internal/messaging/encode/route_message_encoder.rb +0 -24
- data/ruby/neo4j/driver/internal/messaging/encode/route_v44_message_encoder.rb +0 -22
- data/ruby/neo4j/driver/internal/messaging/encode/run_message_encoder.rb +0 -16
- data/ruby/neo4j/driver/internal/messaging/encode/run_with_metadata_message_encoder.rb +0 -17
- data/ruby/neo4j/driver/internal/messaging/request/abstract_streaming_message.rb +0 -25
- data/ruby/neo4j/driver/internal/messaging/request/begin_message.rb +0 -25
- data/ruby/neo4j/driver/internal/messaging/request/commit_message.rb +0 -20
- data/ruby/neo4j/driver/internal/messaging/request/discard_all_message.rb +0 -20
- data/ruby/neo4j/driver/internal/messaging/request/discard_message.rb +0 -23
- data/ruby/neo4j/driver/internal/messaging/request/goodbye_message.rb +0 -20
- data/ruby/neo4j/driver/internal/messaging/request/hello_message.rb +0 -30
- data/ruby/neo4j/driver/internal/messaging/request/init_message.rb +0 -19
- data/ruby/neo4j/driver/internal/messaging/request/logoff_message.rb +0 -13
- data/ruby/neo4j/driver/internal/messaging/request/logon_message.rb +0 -13
- data/ruby/neo4j/driver/internal/messaging/request/message_with_metadata.rb +0 -17
- data/ruby/neo4j/driver/internal/messaging/request/multi_database_util.rb +0 -26
- data/ruby/neo4j/driver/internal/messaging/request/pull_all_message.rb +0 -23
- data/ruby/neo4j/driver/internal/messaging/request/pull_message.rb +0 -22
- data/ruby/neo4j/driver/internal/messaging/request/reset_message.rb +0 -32
- data/ruby/neo4j/driver/internal/messaging/request/rollback_message.rb +0 -20
- data/ruby/neo4j/driver/internal/messaging/request/route_message.rb +0 -28
- data/ruby/neo4j/driver/internal/messaging/request/run_message.rb +0 -23
- data/ruby/neo4j/driver/internal/messaging/request/run_with_metadata_message.rb +0 -49
- data/ruby/neo4j/driver/internal/messaging/request/transaction_metadata_builder.rb +0 -24
- data/ruby/neo4j/driver/internal/messaging/response/failure_message.rb +0 -40
- data/ruby/neo4j/driver/internal/messaging/response/ignored_message.rb +0 -29
- data/ruby/neo4j/driver/internal/messaging/response/record_message.rb +0 -33
- data/ruby/neo4j/driver/internal/messaging/response/success_message.rb +0 -34
- data/ruby/neo4j/driver/internal/messaging/v3/bolt_protocol_v3.rb +0 -82
- data/ruby/neo4j/driver/internal/messaging/v3/message_format_v3.rb +0 -17
- data/ruby/neo4j/driver/internal/messaging/v3/message_writer_v3.rb +0 -27
- data/ruby/neo4j/driver/internal/messaging/v4/bolt_protocol_v4.rb +0 -29
- data/ruby/neo4j/driver/internal/messaging/v4/message_format_v4.rb +0 -13
- data/ruby/neo4j/driver/internal/messaging/v4/message_writer_v4.rb +0 -17
- data/ruby/neo4j/driver/internal/messaging/v41/bolt_protocol_v41.rb +0 -25
- data/ruby/neo4j/driver/internal/messaging/v42/bolt_protocol_v42.rb +0 -13
- data/ruby/neo4j/driver/internal/messaging/v43/bolt_protocol_v43.rb +0 -19
- data/ruby/neo4j/driver/internal/messaging/v43/message_format_v43.rb +0 -14
- data/ruby/neo4j/driver/internal/messaging/v43/message_writer_v43.rb +0 -20
- data/ruby/neo4j/driver/internal/messaging/v44/bolt_protocol_v44.rb +0 -17
- data/ruby/neo4j/driver/internal/messaging/v44/message_format_v44.rb +0 -14
- data/ruby/neo4j/driver/internal/messaging/v44/message_writer_v44.rb +0 -15
- data/ruby/neo4j/driver/internal/messaging/v5/bolt_protocol_v5.rb +0 -21
- data/ruby/neo4j/driver/internal/messaging/v5/message_format_v5.rb +0 -18
- data/ruby/neo4j/driver/internal/messaging/v5/value_unpacker_v5.rb +0 -17
- data/ruby/neo4j/driver/internal/messaging/v51/bolt_protocol_v51.rb +0 -40
- data/ruby/neo4j/driver/internal/messaging/v51/message_format_v51.rb +0 -14
- data/ruby/neo4j/driver/internal/messaging/v51/message_writer_v51.rb +0 -17
- data/ruby/neo4j/driver/internal/metrics/connection_pool_metrics_listener.rb +0 -34
- data/ruby/neo4j/driver/internal/metrics/internal_abstract_metrics.rb +0 -46
- data/ruby/neo4j/driver/internal/metrics/internal_connection_pool_metrics.rb +0 -105
- data/ruby/neo4j/driver/internal/metrics/internal_metrics.rb +0 -82
- data/ruby/neo4j/driver/internal/metrics/internal_metrics_provider.rb +0 -18
- data/ruby/neo4j/driver/internal/metrics/listener_event.rb +0 -17
- data/ruby/neo4j/driver/internal/metrics/metrics_provider.rb +0 -24
- data/ruby/neo4j/driver/internal/metrics/time_recorder_listener_event.rb +0 -15
- data/ruby/neo4j/driver/internal/packstream/byte_array_incompatible_packer.rb +0 -12
- data/ruby/neo4j/driver/internal/packstream/pack_input.rb +0 -47
- data/ruby/neo4j/driver/internal/packstream/pack_output.rb +0 -39
- data/ruby/neo4j/driver/internal/packstream/pack_stream.rb +0 -326
- data/ruby/neo4j/driver/internal/packstream/pack_type.rb +0 -17
- data/ruby/neo4j/driver/internal/read_only_bookmark_holder.rb +0 -13
- data/ruby/neo4j/driver/internal/resolved_bolt_server_address.rb +0 -35
- data/ruby/neo4j/driver/internal/retry/exponential_backoff_retry_logic.rb +0 -151
- data/ruby/neo4j/driver/internal/revocation_strategy.rb +0 -19
- data/ruby/neo4j/driver/internal/scheme.rb +0 -32
- data/ruby/neo4j/driver/internal/security/internal_auth_token.rb +0 -15
- data/ruby/neo4j/driver/internal/security/security_plan_impl.rb +0 -48
- data/ruby/neo4j/driver/internal/security_setting.rb +0 -66
- data/ruby/neo4j/driver/internal/session_factory_impl.rb +0 -32
- data/ruby/neo4j/driver/internal/spi/connection.rb +0 -19
- data/ruby/neo4j/driver/internal/spi/connection_pool.rb +0 -9
- data/ruby/neo4j/driver/internal/spi/response_handler.rb +0 -23
- data/ruby/neo4j/driver/internal/summary/internal_database_info.rb +0 -7
- data/ruby/neo4j/driver/internal/summary/internal_input_position.rb +0 -11
- data/ruby/neo4j/driver/internal/summary/internal_notification.rb +0 -16
- data/ruby/neo4j/driver/internal/summary/internal_plan.rb +0 -41
- data/ruby/neo4j/driver/internal/summary/internal_profiled_plan.rb +0 -32
- data/ruby/neo4j/driver/internal/summary/internal_result_summary.rb +0 -33
- data/ruby/neo4j/driver/internal/summary/internal_server_info.rb +0 -6
- data/ruby/neo4j/driver/internal/summary/internal_summary_counters.rb +0 -18
- data/ruby/neo4j/driver/internal/svm/netty_substitutions.rb +0 -196
- data/ruby/neo4j/driver/internal/svm/z_lib_substitutions.rb +0 -21
- data/ruby/neo4j/driver/internal/util/certificate_tool.rb +0 -65
- data/ruby/neo4j/driver/internal/util/clock.rb +0 -29
- data/ruby/neo4j/driver/internal/util/error_util.rb +0 -104
- data/ruby/neo4j/driver/internal/util/extract.rb +0 -123
- data/ruby/neo4j/driver/internal/util/format.rb +0 -39
- data/ruby/neo4j/driver/internal/util/futures.rb +0 -99
- data/ruby/neo4j/driver/internal/util/iterables.rb +0 -35
- data/ruby/neo4j/driver/internal/util/lock_util.rb +0 -23
- data/ruby/neo4j/driver/internal/util/metadata_extractor.rb +0 -107
- data/ruby/neo4j/driver/internal/util/mutex.rb +0 -9
- data/ruby/neo4j/driver/internal/util/preconditions.rb +0 -16
- data/ruby/neo4j/driver/internal/util/result_holder.rb +0 -72
- data/ruby/neo4j/driver/internal/util/server_version.rb +0 -60
- data/ruby/neo4j/driver/logging1.rb +0 -51
- data/ruby/neo4j/driver/net/server_address.rb +0 -9
- data/ruby/neo4j/driver/query.rb +0 -48
- data/ruby/neo4j/driver/records.rb +0 -13
- data/ruby/neo4j/driver/transaction_config.rb +0 -50
- data/ruby/neo4j/driver/values.rb +0 -26
- data/ruby/neo4j/driver.rb +0 -28
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b150718dde06f62283bdde11edaca77f17a31cd9d5988229c7f9f11d0579f5fb
|
|
4
|
+
data.tar.gz: 685a04443a4a9c8e8c90a3524a650166a6d63976d92e2e6418cd2807e2a531ef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c988f11be9f369490e07f0de554590059f6b61f782abf9e16d48c16237e9298b88a5f7776d632bab79a6e0138f973cf11e2058a8d611e099ff59349d15668bb1
|
|
7
|
+
data.tar.gz: 5ebe999f029edd2b4a20953b39176c1d3a6fd1c6fcf739c95084dabb7499b2e37f3fcd832a780d1dc8b2485a070ad18f6e72a0be62e2cfed62182b847c44dc9c
|
data/README.md
CHANGED
|
@@ -1,12 +1,50 @@
|
|
|
1
|
-
# Neo4j
|
|
1
|
+
# Neo4j Ruby Driver
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This repository contains 2 implementation of a Neo4j driver for Ruby:
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
-
|
|
7
|
-
- pure ruby implmementation. Available on all ruby versions >= 3.1.
|
|
5
|
+
- based on official Java implementation. It provides a thin wrapper over the Java driver (only on jruby).
|
|
6
|
+
- pure Ruby implementation. Available on all Ruby versions >= 3.1.
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
Network communication is handled using [Bolt Protocol](https://7687.org/).
|
|
9
|
+
|
|
10
|
+
<details>
|
|
11
|
+
<summary>Table of Contents</summary>
|
|
12
|
+
|
|
13
|
+
* [Getting started](#getting-started)
|
|
14
|
+
* [Installation](#installation)
|
|
15
|
+
* [Getting a Neo4j instance](#getting-a-neo4j-instance)
|
|
16
|
+
* [Quick start example](#quick-start-example)
|
|
17
|
+
* [Server Compatibility](#server-compatibility)
|
|
18
|
+
* [Usage](#usage)
|
|
19
|
+
* [Connecting to a database](#connecting-to-a-database)
|
|
20
|
+
* [URI schemes](#uri-schemes)
|
|
21
|
+
* [Authentication](#authentication)
|
|
22
|
+
* [Configuration](#configuration)
|
|
23
|
+
* [Connectivity check](#connectivity-check)
|
|
24
|
+
* [Sessions & transactions](#sessions--transactions)
|
|
25
|
+
* [Session](#session)
|
|
26
|
+
* [Auto-commit transactions](#auto-commit-transactions)
|
|
27
|
+
* [Explicit transactions](#explicit-transactions)
|
|
28
|
+
* [Read transactions](#read-transactions)
|
|
29
|
+
* [Write transactions](#write-transactions)
|
|
30
|
+
* [Working with results](#working-with-results)
|
|
31
|
+
* [Accessing Node and Relationship data](#accessing-node-and-relationship-data)
|
|
32
|
+
* [Working with Paths](#working-with-paths)
|
|
33
|
+
* [Working with temporal types](#working-with-temporal-types)
|
|
34
|
+
* [Type mapping](#type-mapping)
|
|
35
|
+
* [Advanced](#advanced)
|
|
36
|
+
* [Connection pooling](#connection-pooling)
|
|
37
|
+
* [Logging](#logging)
|
|
38
|
+
* [For Driver Engineers](#for-driver-engineers)
|
|
39
|
+
* [Testing](#testing)
|
|
40
|
+
* [Contributing](#contributing)
|
|
41
|
+
* [License](#license)
|
|
42
|
+
|
|
43
|
+
</details>
|
|
44
|
+
|
|
45
|
+
## Getting started
|
|
46
|
+
|
|
47
|
+
### Installation
|
|
10
48
|
|
|
11
49
|
Add this line to your application's Gemfile:
|
|
12
50
|
|
|
@@ -16,68 +54,430 @@ gem 'neo4j-ruby-driver'
|
|
|
16
54
|
|
|
17
55
|
And then execute:
|
|
18
56
|
|
|
19
|
-
|
|
57
|
+
```bash
|
|
58
|
+
bundle install
|
|
59
|
+
```
|
|
20
60
|
|
|
21
61
|
Or install it yourself as:
|
|
22
62
|
|
|
23
|
-
|
|
63
|
+
```bash
|
|
64
|
+
gem install neo4j-ruby-driver
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Getting a Neo4j instance
|
|
68
|
+
|
|
69
|
+
You need a running Neo4j database in order to use the driver with it. The easiest way to spin up a **local instance** is
|
|
70
|
+
through a Docker container.
|
|
71
|
+
|
|
72
|
+
The command below runs the latest Neo4j version in Docker, setting the admin username and password to `neo4j` and
|
|
73
|
+
`password` respectively:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
docker run \
|
|
77
|
+
-p7474:7474 \
|
|
78
|
+
-p7687:7687 \
|
|
79
|
+
-d \
|
|
80
|
+
-e NEO4J_AUTH=neo4j/password \
|
|
81
|
+
neo4j:latest
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Quick start example
|
|
85
|
+
|
|
86
|
+
```ruby
|
|
87
|
+
require 'neo4j/driver'
|
|
88
|
+
|
|
89
|
+
Neo4j::Driver::GraphDatabase.driver(
|
|
90
|
+
'bolt://localhost:7687',
|
|
91
|
+
Neo4j::Driver::AuthTokens.basic('neo4j', 'password')
|
|
92
|
+
) do |driver|
|
|
93
|
+
driver.session(database: 'neo4j') do |session|
|
|
94
|
+
query_result = session.run('RETURN 2+2 AS value')
|
|
95
|
+
puts "2+2 equals #{query_result.single['value']}"
|
|
96
|
+
|
|
97
|
+
# consume gives the execution summary
|
|
98
|
+
create_result = session.run('CREATE (n)').consume
|
|
99
|
+
puts "Nodes created: #{create_result.counters.nodes_created}"
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
```
|
|
24
103
|
|
|
25
104
|
## Server Compatibility
|
|
26
105
|
|
|
27
|
-
The compatibility with Neo4j Server versions is documented in
|
|
106
|
+
The compatibility with Neo4j Server versions is documented in
|
|
107
|
+
the [Neo4j Knowledge Base](https://neo4j.com/developer/kb/neo4j-supported-versions/).
|
|
28
108
|
|
|
29
109
|
## Usage
|
|
30
110
|
|
|
31
|
-
The API is to highest possible degree consistent with the official
|
|
32
|
-
|
|
111
|
+
The API is to highest possible degree consistent with the official Java driver. Please refer to
|
|
112
|
+
the [Neo4j Java Driver Manual](https://neo4j.com/docs/java-manual/current/), [examples in Ruby](https://github.com/neo4jrb/neo4j-ruby-driver/blob/master/docs/dev_manual_examples.rb),
|
|
113
|
+
and code snippets below to understand how to use it.
|
|
114
|
+
[Neo4j Java Driver API Docs](https://neo4j.com/docs/api/java-driver/current/) can be helpful as well.
|
|
115
|
+
|
|
116
|
+
### Connecting to a database
|
|
117
|
+
|
|
118
|
+
#### URI schemes
|
|
119
|
+
|
|
120
|
+
The driver supports the following URI schemes:
|
|
121
|
+
|
|
122
|
+
| URI Scheme | Description |
|
|
123
|
+
|----------------|---------------------------------------------------------------------------------|
|
|
124
|
+
| `neo4j://` | Connect using routing to a cluster/causal cluster. |
|
|
125
|
+
| `neo4j+s://` | Same as `neo4j://` but with full TLS encryption. |
|
|
126
|
+
| `neo4j+ssc://` | Same as `neo4j://` but with full TLS encryption, without hostname verification. |
|
|
127
|
+
| `bolt://` | Connect directly to a server using the Bolt protocol. |
|
|
128
|
+
| `bolt+s://` | Same as `bolt://` but with full TLS encryption. |
|
|
129
|
+
| `bolt+ssc://` | Same as `bolt://` but with full TLS encryption, without hostname verification. |
|
|
130
|
+
|
|
131
|
+
Example:
|
|
132
|
+
|
|
133
|
+
```ruby
|
|
134
|
+
# Connect to a single instance
|
|
135
|
+
driver = Neo4j::Driver::GraphDatabase.driver(
|
|
136
|
+
'bolt://localhost:7687',
|
|
137
|
+
Neo4j::Driver::AuthTokens.basic('neo4j', 'password')
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
# Connect to a cluster
|
|
141
|
+
driver = Neo4j::Driver::GraphDatabase.driver(
|
|
142
|
+
'neo4j://graph.example.com:7687',
|
|
143
|
+
Neo4j::Driver::AuthTokens.basic('neo4j', 'password')
|
|
144
|
+
)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
#### Authentication
|
|
148
|
+
|
|
149
|
+
The driver provides multiple authentication methods:
|
|
150
|
+
|
|
151
|
+
```ruby
|
|
152
|
+
# Basic authentication
|
|
153
|
+
auth = Neo4j::Driver::AuthTokens.basic('neo4j', 'password')
|
|
154
|
+
|
|
155
|
+
# With realm specification
|
|
156
|
+
auth = Neo4j::Driver::AuthTokens.basic('neo4j', 'password', 'realm')
|
|
157
|
+
|
|
158
|
+
# Kerberos authentication
|
|
159
|
+
auth = Neo4j::Driver::AuthTokens.kerberos('ticket')
|
|
160
|
+
|
|
161
|
+
# Bearer authentication
|
|
162
|
+
auth = Neo4j::Driver::AuthTokens.bearer('token')
|
|
163
|
+
|
|
164
|
+
# Custom authentication
|
|
165
|
+
auth = Neo4j::Driver::AuthTokens.custom('principal', 'credentials', 'realm', 'scheme')
|
|
166
|
+
|
|
167
|
+
# No authentication
|
|
168
|
+
auth = Neo4j::Driver::AuthTokens.none
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
#### Configuration
|
|
172
|
+
|
|
173
|
+
You can configure the driver with additional options:
|
|
174
|
+
|
|
175
|
+
```ruby
|
|
176
|
+
config = {
|
|
177
|
+
connection_timeout: 15.seconds,
|
|
178
|
+
connection_acquisition_timeout: 1.minute,
|
|
179
|
+
max_transaction_retry_time: 30.seconds,
|
|
180
|
+
encryption: true,
|
|
181
|
+
trust_strategy: :trust_all_certificates
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
driver = Neo4j::Driver::GraphDatabase.driver(
|
|
185
|
+
'neo4j://localhost:7687',
|
|
186
|
+
Neo4j::Driver::AuthTokens.basic('neo4j', 'password'),
|
|
187
|
+
**config
|
|
188
|
+
)
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
#### Connectivity check
|
|
192
|
+
|
|
193
|
+
```ruby
|
|
194
|
+
if driver.verify_connectivity
|
|
195
|
+
puts "Driver is connected to the database"
|
|
196
|
+
else
|
|
197
|
+
puts "Driver cannot connect to the database"
|
|
198
|
+
end
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Sessions & transactions
|
|
202
|
+
|
|
203
|
+
The driver provides sessions to interact with the database and to execute queries.
|
|
204
|
+
|
|
205
|
+
#### Session
|
|
206
|
+
|
|
207
|
+
Sessions are lightweight and disposable database connections. Always close your sessions when done:
|
|
208
|
+
|
|
209
|
+
```ruby
|
|
210
|
+
session = driver.session(database: 'neo4j')
|
|
211
|
+
begin
|
|
212
|
+
session.run('MATCH (n) RETURN n LIMIT 10')
|
|
213
|
+
ensure
|
|
214
|
+
session.close
|
|
215
|
+
end
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Or use a block that automatically closes the session:
|
|
219
|
+
|
|
220
|
+
```ruby
|
|
221
|
+
driver.session(database: 'neo4j') do |session|
|
|
222
|
+
session.run('MATCH (n) RETURN n LIMIT 10')
|
|
223
|
+
end
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Session options:
|
|
227
|
+
|
|
228
|
+
```ruby
|
|
229
|
+
# Default database
|
|
230
|
+
session = driver.session
|
|
231
|
+
|
|
232
|
+
# Specific database
|
|
233
|
+
session = driver.session(database: 'neo4j')
|
|
234
|
+
|
|
235
|
+
# With access mode
|
|
236
|
+
session = driver.session(database: 'neo4j', default_access_mode: Neo4j::Driver::AccessMode::READ)
|
|
237
|
+
|
|
238
|
+
# With bookmarks for causal consistency
|
|
239
|
+
session = driver.session(
|
|
240
|
+
database: 'neo4j',
|
|
241
|
+
bookmarks: [Neo4j::Driver::Bookmark.from('bookmark-1')]
|
|
242
|
+
)
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
#### Auto-commit transactions
|
|
246
|
+
|
|
247
|
+
For simple, one-off queries, use auto-commit transactions:
|
|
248
|
+
|
|
249
|
+
```ruby
|
|
250
|
+
session.run('CREATE (n:Person {name: $name})', name: 'Alice')
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
#### Explicit transactions
|
|
254
|
+
|
|
255
|
+
For multiple queries that need to be executed as a unit, use explicit transactions:
|
|
256
|
+
|
|
257
|
+
```ruby
|
|
258
|
+
tx = session.begin_transaction
|
|
259
|
+
begin
|
|
260
|
+
tx.run('CREATE (n:Person {name: $name})', name: 'Alice')
|
|
261
|
+
tx.run('CREATE (n:Person {name: $name})', name: 'Bob')
|
|
262
|
+
tx.commit
|
|
263
|
+
rescue
|
|
264
|
+
tx.rollback
|
|
265
|
+
raise
|
|
266
|
+
end
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
#### Read transactions
|
|
270
|
+
|
|
271
|
+
Specifically for read operations:
|
|
272
|
+
|
|
273
|
+
```ruby
|
|
274
|
+
result = session.read_transaction do |tx|
|
|
275
|
+
tx.run('MATCH (n:Person) RETURN n.name').map { |record| record['n.name'] }
|
|
276
|
+
end
|
|
277
|
+
puts result
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
#### Write transactions
|
|
281
|
+
|
|
282
|
+
Specifically for write operations:
|
|
283
|
+
|
|
284
|
+
```ruby
|
|
285
|
+
session.write_transaction do |tx|
|
|
286
|
+
tx.run('CREATE (n:Person {name: $name})', name: 'Charlie')
|
|
287
|
+
end
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### Working with results
|
|
291
|
+
|
|
292
|
+
```ruby
|
|
293
|
+
result = session.run('MATCH (n:Person) RETURN n.name AS name, n.age AS age')
|
|
294
|
+
|
|
295
|
+
# Process results
|
|
296
|
+
result.each do |record|
|
|
297
|
+
puts "#{record['name']} is #{record['age']} years old"
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
# Check if there are more results
|
|
301
|
+
puts "Has more results: #{result.has_next?}"
|
|
302
|
+
|
|
303
|
+
# Get a single record
|
|
304
|
+
single = result.single
|
|
305
|
+
puts single['name'] if single
|
|
306
|
+
|
|
307
|
+
# Get keys available in the result
|
|
308
|
+
puts "Keys: #{result.keys}"
|
|
309
|
+
|
|
310
|
+
# Access by field index
|
|
311
|
+
result.each do |record|
|
|
312
|
+
puts "First field: #{record[0]}"
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
# Convert to array
|
|
316
|
+
records = result.to_a
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
#### Accessing Node and Relationship data
|
|
320
|
+
|
|
321
|
+
Working with graph entities:
|
|
322
|
+
|
|
323
|
+
```ruby
|
|
324
|
+
result = session.run('MATCH (p:Person)-[r:KNOWS]->(friend) RETURN p, r, friend')
|
|
325
|
+
|
|
326
|
+
result.each do |record|
|
|
327
|
+
# Working with nodes
|
|
328
|
+
person = record['p']
|
|
329
|
+
puts "Node ID: #{person.id}"
|
|
330
|
+
puts "Labels: #{person.labels.join(', ')}"
|
|
331
|
+
puts "Properties: #{person.properties}"
|
|
332
|
+
puts "Name property: #{person.properties['name']}"
|
|
333
|
+
|
|
334
|
+
# Working with relationships
|
|
335
|
+
relationship = record['r']
|
|
336
|
+
puts "Relationship ID: #{relationship.id}"
|
|
337
|
+
puts "Type: #{relationship.type}"
|
|
338
|
+
puts "Properties: #{relationship.properties}"
|
|
339
|
+
|
|
340
|
+
# Start and end nodes of the relationship
|
|
341
|
+
puts "Relationship: #{relationship.start_node_id} -> #{relationship.end_node_id}"
|
|
342
|
+
end
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
#### Working with Paths
|
|
346
|
+
|
|
347
|
+
Processing paths returned from Cypher:
|
|
348
|
+
|
|
349
|
+
```ruby
|
|
350
|
+
result = session.run('MATCH p = (:Person)-[:KNOWS*]->(:Person) RETURN p')
|
|
351
|
+
|
|
352
|
+
result.each do |record|
|
|
353
|
+
path = record['p']
|
|
354
|
+
|
|
355
|
+
# Get all nodes in the path
|
|
356
|
+
nodes = path.nodes
|
|
357
|
+
puts "Nodes in path: #{nodes.map { |n| n.properties['name'] }.join(' -> ')}"
|
|
358
|
+
|
|
359
|
+
# Get all relationships in the path
|
|
360
|
+
relationships = path.relationships
|
|
361
|
+
puts "Relationship types: #{relationships.map(&:type).join(', ')}"
|
|
362
|
+
|
|
363
|
+
# Iterate through the path segments
|
|
364
|
+
path.each do |segment|
|
|
365
|
+
puts "#{segment.start_node.properties['name']} -[#{segment.relationship.type}]-> #{segment.end_node.properties['name']}"
|
|
366
|
+
end
|
|
367
|
+
end
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
#### Working with temporal types
|
|
371
|
+
|
|
372
|
+
Creating a node with properties of temporal types:
|
|
373
|
+
|
|
374
|
+
```ruby
|
|
375
|
+
session.run(
|
|
376
|
+
'CREATE (e:Event {datetime: $datetime, duration: $duration})',
|
|
377
|
+
datetime: DateTime.new(2025, 5, 5, 5, 55, 55), duration: 1.hour
|
|
378
|
+
)
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
Querying temporal values:
|
|
382
|
+
|
|
383
|
+
```ruby
|
|
384
|
+
session.run('MATCH (e:Event) LIMIT 1 RETURN e.datetime, e.duration').single.to_h
|
|
385
|
+
# => {"e.datetime": 2025-05-05 05:55:55 +0000, "e.duration": 3600 seconds}
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### Type mapping
|
|
33
389
|
|
|
34
|
-
|
|
390
|
+
The Neo4j Ruby Driver maps Cypher types to Ruby types:
|
|
35
391
|
|
|
36
|
-
|
|
392
|
+
| Cypher Type | Ruby Type |
|
|
393
|
+
|----------------|-----------------------------------------------|
|
|
394
|
+
| null | nil |
|
|
395
|
+
| List | Enumerable |
|
|
396
|
+
| Map | Hash (symbolized keys) |
|
|
397
|
+
| Boolean | TrueClass/FalseClass |
|
|
398
|
+
| Integer | Integer/String[^1] |
|
|
399
|
+
| Float | Float |
|
|
400
|
+
| String | String/Symbol[^2] (encoding: UTF-8) |
|
|
401
|
+
| ByteArray | String (encoding: BINARY) |
|
|
402
|
+
| Date | Date |
|
|
403
|
+
| Zoned Time | Neo4j::Driver::Types::OffsetTime |
|
|
404
|
+
| Local Time | Neo4j::Driver::Types::LocalTime |
|
|
405
|
+
| Zoned DateTime | Time/ActiveSupport::TimeWithZone/DateTime[^3] |
|
|
406
|
+
| Local DateTime | Neo4j::Driver::Types::LocalDateTime |
|
|
407
|
+
| Duration | ActiveSupport::Duration |
|
|
408
|
+
| Point | Neo4j::Driver::Types::Point |
|
|
409
|
+
| Node | Neo4j::Driver::Types::Node |
|
|
410
|
+
| Relationship | Neo4j::Driver::Types::Relationship |
|
|
411
|
+
| Path | Neo4j::Driver::Types::Path |
|
|
37
412
|
|
|
38
|
-
|
|
413
|
+
[^1]: An Integer smaller than -2 ** 63 or larger than 2 ** 63 will always be implicitly converted to String
|
|
414
|
+
[^2]: A Symbol passed as a parameter will always be implicitly converted to String. All Strings other than BINARY
|
|
415
|
+
encoded are converted to UTF-8 when stored in Neo4j
|
|
416
|
+
[^3]: A Ruby DateTime passed as a parameter will always be implicitly converted to Time
|
|
39
417
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
## Testing
|
|
418
|
+
### Advanced
|
|
43
419
|
|
|
44
|
-
|
|
420
|
+
#### Connection pooling
|
|
45
421
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
422
|
+
The driver handles connection pooling automatically. Configure the connection pool:
|
|
423
|
+
|
|
424
|
+
```ruby
|
|
425
|
+
config = {
|
|
426
|
+
max_connection_pool_size: 100,
|
|
427
|
+
max_connection_lifetime: 1.hour
|
|
428
|
+
}
|
|
52
429
|
|
|
53
|
-
|
|
54
|
-
```console
|
|
55
|
-
$ bin/setup
|
|
56
|
-
$ rspec spec
|
|
430
|
+
driver = Neo4j::Driver::GraphDatabase.driver('neo4j://localhost:7687', auth, **config)
|
|
57
431
|
```
|
|
58
432
|
|
|
59
|
-
|
|
433
|
+
#### Logging
|
|
60
434
|
|
|
61
|
-
|
|
435
|
+
Configure logging for the driver:
|
|
62
436
|
|
|
63
|
-
```
|
|
64
|
-
|
|
437
|
+
```ruby
|
|
438
|
+
config = {
|
|
439
|
+
logger: Logger.new(STDOUT).tap { |log| log.level = Logger::DEBUG }
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
driver = Neo4j::Driver::GraphDatabase.driver('neo4j://localhost:7687', auth, **config)
|
|
65
443
|
```
|
|
66
444
|
|
|
67
|
-
|
|
445
|
+
## For Driver Engineers
|
|
68
446
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
447
|
+
This gem includes 2 different implementations: a Java driver wrapper and a pure Ruby driver, so you will have to run
|
|
448
|
+
this command every time you switch the Ruby engine:
|
|
449
|
+
|
|
450
|
+
```bash
|
|
451
|
+
bin/setup
|
|
74
452
|
```
|
|
75
453
|
|
|
454
|
+
### Testing
|
|
455
|
+
|
|
456
|
+
There are two sets of tests for the driver. To run the specs placed in this repository, use a normal rspec command:
|
|
457
|
+
|
|
458
|
+
```bash
|
|
459
|
+
rspec spec
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
To run the [Testkit](https://github.com/neo4j-drivers/testkit) that is used to test all Neo4j driver implementations,
|
|
463
|
+
use the following:
|
|
464
|
+
|
|
465
|
+
```bash
|
|
466
|
+
git clone git@github.com:neo4j-drivers/testkit.git
|
|
467
|
+
cd testkit
|
|
468
|
+
export TEST_DRIVER_NAME=ruby
|
|
469
|
+
export TEST_DRIVER_REPO=`realpath ../neo4j-ruby-driver`
|
|
470
|
+
export TEST_NEO4J_PASS=password
|
|
471
|
+
python3 main.py --tests UNIT_TESTS --configs 4.3-enterprise
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
Please refer to the [Testkit](https://github.com/neo4j-drivers/testkit) documentation to learn more about its features.
|
|
475
|
+
|
|
76
476
|
## Contributing
|
|
77
477
|
|
|
78
|
-
Suggestions, improvements, bug reports and pull requests are welcome on GitHub
|
|
478
|
+
Suggestions, improvements, bug reports and pull requests are welcome on GitHub
|
|
479
|
+
at https://github.com/neo4jrb/neo4j-ruby-driver.
|
|
79
480
|
|
|
80
481
|
## License
|
|
81
482
|
|
|
82
483
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
83
|
-
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Neo4j::Driver::Ext
|
|
4
|
+
module AsyncConverter
|
|
5
|
+
include ExceptionMapper
|
|
6
|
+
|
|
7
|
+
private
|
|
8
|
+
|
|
9
|
+
class Variable
|
|
10
|
+
def initialize(condition = ::Async::Condition.new)
|
|
11
|
+
@condition = condition
|
|
12
|
+
@value = nil
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def resolve(value = true)
|
|
16
|
+
@value = value
|
|
17
|
+
condition = @condition
|
|
18
|
+
@condition = nil
|
|
19
|
+
|
|
20
|
+
self.freeze
|
|
21
|
+
|
|
22
|
+
condition.signal(value)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def resolved?
|
|
26
|
+
@condition.nil?
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def value
|
|
30
|
+
@condition&.wait
|
|
31
|
+
return @value
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def wait
|
|
35
|
+
self.value
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def to_future(completion_stage)
|
|
40
|
+
Concurrent::Promises.resolvable_future.tap do |future|
|
|
41
|
+
completion_stage.then_apply(&future.method(:fulfill)).exceptionally { |e| future.reject(mapped_exception(e.cause)) }
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def to_async(completion_stage)
|
|
46
|
+
variable = Variable.new
|
|
47
|
+
completion_stage.when_complete do |value, error|
|
|
48
|
+
variable.resolve([value, error])
|
|
49
|
+
end
|
|
50
|
+
value, error = variable.wait
|
|
51
|
+
raise mapped_exception(e.cause) if error
|
|
52
|
+
value
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Neo4j
|
|
4
|
+
module Driver
|
|
5
|
+
module Ext
|
|
6
|
+
module AuthTokens
|
|
7
|
+
include NeoConverter
|
|
8
|
+
|
|
9
|
+
def basic(username, password, realm = nil)
|
|
10
|
+
Neo4j::Driver::Internal::Validator.require_non_nil_credentials!(username, password)
|
|
11
|
+
super
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def custom(principal, credentials, realm, scheme, **parameters)
|
|
15
|
+
super(principal, credentials, realm, scheme, to_neo(parameters))
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Neo4j
|
|
4
|
+
module Driver
|
|
5
|
+
module Ext
|
|
6
|
+
module ConfigConverter
|
|
7
|
+
include NeoConverter
|
|
8
|
+
|
|
9
|
+
private
|
|
10
|
+
|
|
11
|
+
def to_java_config(builder_class, **hash)
|
|
12
|
+
apply_to(builder_class.builder, **hash).build
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def apply_to(builder, **hash)
|
|
16
|
+
hash.compact.reduce(builder) { |object, (key, value)| object.send(*config_method(key, value)) }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def config_method(key, value)
|
|
20
|
+
method = :"with_#{key}"
|
|
21
|
+
unit = nil
|
|
22
|
+
case key.to_s
|
|
23
|
+
when 'encryption', 'driver_metrics', 'hostname_verification'
|
|
24
|
+
method = :"without_#{key}" unless value
|
|
25
|
+
value = nil
|
|
26
|
+
when 'timeout'
|
|
27
|
+
value = java.time.Duration.ofMillis(Driver::Internal::DurationNormalizer.milliseconds(value))
|
|
28
|
+
when /time(out)?$/, 'routing_table_purge_delay'
|
|
29
|
+
value = Driver::Internal::DurationNormalizer.milliseconds(value) || -1
|
|
30
|
+
unit = java.util.concurrent.TimeUnit::MILLISECONDS
|
|
31
|
+
when 'logger'
|
|
32
|
+
method = :with_logging
|
|
33
|
+
value = Neo4j::Driver::Ext::Logger.new(value)
|
|
34
|
+
when 'resolver'
|
|
35
|
+
proc = value
|
|
36
|
+
value = ->(address) { java.util.HashSet.new(proc.call(address)) }
|
|
37
|
+
when 'bookmarks'
|
|
38
|
+
return [method, *value]
|
|
39
|
+
when 'trust_strategy'
|
|
40
|
+
value = trust_strategy(**value)
|
|
41
|
+
when 'revocation_strategy'
|
|
42
|
+
method = case value
|
|
43
|
+
when Neo4j::Driver::Internal::RevocationStrategy::NO_CHECKS
|
|
44
|
+
'without_certificate_revocation_checks'
|
|
45
|
+
else
|
|
46
|
+
"with_#{value}_revocation_checks"
|
|
47
|
+
end
|
|
48
|
+
when 'notification_config'
|
|
49
|
+
value = notification_config(**value)
|
|
50
|
+
else
|
|
51
|
+
value = to_neo(value, skip_unknown: true)
|
|
52
|
+
end
|
|
53
|
+
[method, value, unit].compact
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def trust_strategy(**config)
|
|
57
|
+
strategy = config.delete(:strategy)
|
|
58
|
+
trust_strategy =
|
|
59
|
+
case strategy
|
|
60
|
+
when :trust_custom_certificates
|
|
61
|
+
Config::TrustStrategy
|
|
62
|
+
.trust_custom_certificate_signed_by(*config.delete(:cert_files).map(&java.io.File.method(:new)))
|
|
63
|
+
else
|
|
64
|
+
Config::TrustStrategy.send(strategy)
|
|
65
|
+
end
|
|
66
|
+
apply_to(trust_strategy, **config)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def notification_config(minimum_severity: nil, disabled_categories: nil)
|
|
70
|
+
org.neo4j.driver.internal.InternalNotificationConfig.new(
|
|
71
|
+
value_of(org.neo4j.driver.internal.InternalNotificationSeverity, minimum_severity).or_else(nil),
|
|
72
|
+
disabled_categories
|
|
73
|
+
&.map { |value| value_of(org.neo4j.driver.NotificationClassification, value) }
|
|
74
|
+
&.then(&java.util.HashSet.method(:new)))
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def value_of(klass, value)
|
|
78
|
+
klass.value_of(value&.to_s&.upcase)
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|