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
@@ -0,0 +1,101 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Messaging
|
4
|
+
module Common
|
5
|
+
module CommonValuePacker
|
6
|
+
include CommonValue
|
7
|
+
|
8
|
+
def pack(value)
|
9
|
+
case value
|
10
|
+
when ActiveSupport::Duration
|
11
|
+
pack_duration(value)
|
12
|
+
when Types::Point
|
13
|
+
pack_point(value)
|
14
|
+
when Types::OffsetTime
|
15
|
+
pack_time(value)
|
16
|
+
when Types::LocalTime
|
17
|
+
pack_local_time(value)
|
18
|
+
when Types::LocalDateTime
|
19
|
+
pack_local_date_time(value)
|
20
|
+
when ActiveSupport::TimeWithZone
|
21
|
+
pack_date_time_with_zone_id(value)
|
22
|
+
when Time, DateTime
|
23
|
+
pack_date_time_with_zone_offset(value)
|
24
|
+
when Date
|
25
|
+
pack_date(value)
|
26
|
+
else
|
27
|
+
super
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def pack_date(local_date)
|
34
|
+
pack_struct_header(DATE_STRUCT_SIZE, DATE)
|
35
|
+
pack_integer((local_date - EPOCH).to_i)
|
36
|
+
end
|
37
|
+
|
38
|
+
def pack_time(offset_time)
|
39
|
+
pack_struct_header(TIME_STRUCT_SIZE, TIME)
|
40
|
+
pack_nano_of_day(offset_time)
|
41
|
+
pack_utc_offset(offset_time)
|
42
|
+
end
|
43
|
+
|
44
|
+
def pack_utc_offset(time)
|
45
|
+
pack_integer(time.utc_offset)
|
46
|
+
end
|
47
|
+
|
48
|
+
def pack_nano_of_day(local_time)
|
49
|
+
pack_integer(((local_time.hour * 60 + local_time.min) * 60 + local_time.sec) * NANO_FACTOR + local_time.nsec)
|
50
|
+
end
|
51
|
+
|
52
|
+
def pack_local_time(local_time)
|
53
|
+
pack_struct_header(LOCAL_TIME_STRUCT_SIZE, LOCAL_TIME)
|
54
|
+
pack_nano_of_day(local_time)
|
55
|
+
end
|
56
|
+
|
57
|
+
def pack_local_date_time(local_date_time)
|
58
|
+
pack_struct_header(LOCAL_DATE_TIME_STRUCT_SIZE, LOCAL_DATE_TIME)
|
59
|
+
pack_integer(local_date_time.to_i)
|
60
|
+
pack_integer(local_date_time.nsec)
|
61
|
+
end
|
62
|
+
|
63
|
+
def pack_date_time_with_zone_id(time)
|
64
|
+
pack_struct_header(DATE_TIME_STRUCT_SIZE, DATE_TIME_WITH_ZONE_ID)
|
65
|
+
pack_date_time(time)
|
66
|
+
pack_string(time.time_zone.tzinfo.identifier)
|
67
|
+
end
|
68
|
+
|
69
|
+
def pack_date_time(time)
|
70
|
+
pack_integer(time.to_i + time.utc_offset)
|
71
|
+
pack_integer(time.nsec)
|
72
|
+
end
|
73
|
+
|
74
|
+
def pack_date_time_with_zone_offset(time)
|
75
|
+
pack_struct_header(DATE_TIME_STRUCT_SIZE, DATE_TIME_WITH_ZONE_OFFSET)
|
76
|
+
pack_date_time(time)
|
77
|
+
pack_utc_offset(time)
|
78
|
+
end
|
79
|
+
|
80
|
+
def pack_duration(duration)
|
81
|
+
pack_struct_header(DURATION_TIME_STRUCT_SIZE, DURATION)
|
82
|
+
DurationNormalizer.normalize(duration).each(&method(:pack_integer))
|
83
|
+
end
|
84
|
+
|
85
|
+
def pack_point(point)
|
86
|
+
case point.coordinates.size
|
87
|
+
when 2
|
88
|
+
pack_struct_header(POINT_2D_STRUCT_SIZE, POINT_2D_STRUCT_TYPE)
|
89
|
+
when 3
|
90
|
+
pack_struct_header(POINT_3D_STRUCT_SIZE, POINT_3D_STRUCT_TYPE)
|
91
|
+
else
|
92
|
+
raise IOError, "Unknown type: type: #{point.class}, value: #{point.to_s}"
|
93
|
+
end
|
94
|
+
pack_integer(point.srid.to_i)
|
95
|
+
point.coordinates.each(&method(:pack_float))
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,234 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Messaging
|
4
|
+
module Common
|
5
|
+
module CommonValueUnpacker
|
6
|
+
include CommonValue
|
7
|
+
NODE = 'N'
|
8
|
+
RELATIONSHIP = 'R'
|
9
|
+
UNBOUND_RELATIONSHIP = 'r'
|
10
|
+
PATH = 'P'
|
11
|
+
NODE_FIELDS = 3
|
12
|
+
|
13
|
+
def unpack_map(size)
|
14
|
+
size.times.to_h { [unpack.to_sym, unpack] }
|
15
|
+
end
|
16
|
+
|
17
|
+
def unpack_array(size)
|
18
|
+
size.times.map { unpack }
|
19
|
+
end
|
20
|
+
|
21
|
+
def unpack
|
22
|
+
marker_byte = read_byte
|
23
|
+
marker_high_nibble = marker_byte & 0xF0
|
24
|
+
marker_low_nibble = marker_byte & 0x0F
|
25
|
+
|
26
|
+
case marker_high_nibble
|
27
|
+
when TINY_STRING
|
28
|
+
return unpack_string(marker_low_nibble)
|
29
|
+
when TINY_LIST
|
30
|
+
return unpack_array(marker_low_nibble)
|
31
|
+
when TINY_MAP
|
32
|
+
return unpack_map(marker_low_nibble)
|
33
|
+
when TINY_STRUCT
|
34
|
+
return unpack_struct(marker_low_nibble, read_char)
|
35
|
+
end
|
36
|
+
|
37
|
+
case marker_byte & 0xFF # we read a signed byte but markers are unsigned
|
38
|
+
when NULL
|
39
|
+
nil
|
40
|
+
when TRUE
|
41
|
+
true
|
42
|
+
when FALSE
|
43
|
+
false
|
44
|
+
when FLOAT_64
|
45
|
+
unpack_double
|
46
|
+
when BYTES_8
|
47
|
+
unpack_bytes(read_ubyte)
|
48
|
+
when BYTES_16
|
49
|
+
unpack_bytes(read_ushort)
|
50
|
+
when BYTES_32
|
51
|
+
unpack_bytes(read_uint)
|
52
|
+
when STRING_8
|
53
|
+
unpack_string(read_ubyte)
|
54
|
+
when STRING_16
|
55
|
+
unpack_string(read_ushort)
|
56
|
+
when STRING_32
|
57
|
+
unpack_string(read_uint)
|
58
|
+
when LIST_8
|
59
|
+
unpack_array(read_ubyte)
|
60
|
+
when LIST_16
|
61
|
+
unpack_array(read_ushort)
|
62
|
+
when LIST_32
|
63
|
+
unpack_array(read_uint)
|
64
|
+
when MAP_8
|
65
|
+
unpack_map(read_ubyte)
|
66
|
+
when MAP_16
|
67
|
+
unpack_map(read_ushort)
|
68
|
+
when STRUCT_8
|
69
|
+
unpack_struct(read_ubyte, read_char)
|
70
|
+
when STRUCT_16
|
71
|
+
unpack_struct(read_ushort, read_char)
|
72
|
+
else
|
73
|
+
unpack_long(marker_byte)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def unpack_struct(size, type)
|
78
|
+
case type
|
79
|
+
when DATE
|
80
|
+
ensure_correct_struct_size(:DATE, DATE_STRUCT_SIZE, size)
|
81
|
+
unpack_date
|
82
|
+
when TIME
|
83
|
+
ensure_correct_struct_size(:TIME, TIME_STRUCT_SIZE, size)
|
84
|
+
unpack_time
|
85
|
+
when LOCAL_TIME
|
86
|
+
ensure_correct_struct_size(:LOCAL_TIME, LOCAL_TIME_STRUCT_SIZE, size)
|
87
|
+
unpack_local_time
|
88
|
+
when LOCAL_DATE_TIME
|
89
|
+
ensure_correct_struct_size(:LOCAL_DATE_TIME, LOCAL_DATE_TIME_STRUCT_SIZE, size)
|
90
|
+
unpack_local_date_time
|
91
|
+
when DATE_TIME_WITH_ZONE_OFFSET
|
92
|
+
ensure_correct_struct_size(:DATE_TIME_WITH_ZONE_OFFSET, DATE_TIME_STRUCT_SIZE, size)
|
93
|
+
unpack_date_time_with_zone_offset
|
94
|
+
when DATE_TIME_WITH_ZONE_ID
|
95
|
+
ensure_correct_struct_size(:DATE_TIME_WITH_ZONE_ID, DATE_TIME_STRUCT_SIZE, size)
|
96
|
+
unpack_date_time_with_zone_id
|
97
|
+
when DURATION
|
98
|
+
ensure_correct_struct_size(:DURATION, DURATION_TIME_STRUCT_SIZE, size)
|
99
|
+
unpack_duration
|
100
|
+
when POINT_2D_STRUCT_TYPE
|
101
|
+
ensure_correct_struct_size(:POINT, POINT_2D_STRUCT_SIZE, size)
|
102
|
+
unpack_point2_d
|
103
|
+
when POINT_3D_STRUCT_TYPE
|
104
|
+
ensure_correct_struct_size(:POINT, POINT_3D_STRUCT_SIZE, size)
|
105
|
+
unpack_point3_d
|
106
|
+
when NODE
|
107
|
+
ensure_correct_struct_size(:NODE, NODE_FIELDS, size)
|
108
|
+
adapted = unpack_node
|
109
|
+
when RELATIONSHIP
|
110
|
+
ensure_correct_struct_size(:RELATIONSHIP, 5, size)
|
111
|
+
unpack_relationship
|
112
|
+
when UNBOUND_RELATIONSHIP
|
113
|
+
ensure_correct_struct_size(:RELATIONSHIP, 3, size)
|
114
|
+
unpack_unbound_relationship
|
115
|
+
when PATH
|
116
|
+
ensure_correct_struct_size(:PATH, 3, size)
|
117
|
+
unpack_path
|
118
|
+
else
|
119
|
+
raise IOError, "Unknown struct type: #{type}"
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
private
|
124
|
+
|
125
|
+
def unpack_relationship
|
126
|
+
InternalRelationship.new(*4.times.map { unpack }, **unpack)
|
127
|
+
end
|
128
|
+
|
129
|
+
def unpack_unbound_relationship
|
130
|
+
InternalRelationship.new(unpack, nil, nil, unpack, **unpack)
|
131
|
+
end
|
132
|
+
|
133
|
+
def unpack_node
|
134
|
+
InternalNode.new(unpack, *unpack.map(&:to_sym), **unpack)
|
135
|
+
end
|
136
|
+
|
137
|
+
def unpack_path
|
138
|
+
uniq_nodes = unpack
|
139
|
+
uniq_rels = unpack
|
140
|
+
sequence = unpack
|
141
|
+
prev_node = uniq_nodes.first
|
142
|
+
nodes = [prev_node] # Start node is always 0, and isn't encoded in the sequence
|
143
|
+
rels = []
|
144
|
+
path = Types::Path.new(nodes, rels)
|
145
|
+
sequence.in_groups_of(2) do |rel_idx, node_idx|
|
146
|
+
node = uniq_nodes[node_idx]
|
147
|
+
nodes << node
|
148
|
+
rel = uniq_rels[rel_idx.abs - 1] # -1 because rel idx are 1-indexed
|
149
|
+
update(rel, prev_node, node, rel_idx.negative?)
|
150
|
+
rels << rel
|
151
|
+
path << Types::Path::Segment.new(prev_node, rel, node)
|
152
|
+
prev_node = node
|
153
|
+
end
|
154
|
+
path
|
155
|
+
end
|
156
|
+
|
157
|
+
def update(rel, prev_node, node, inversed)
|
158
|
+
# Negative rel index means this rel was traversed "inversed" from its direction
|
159
|
+
prev_node, node = node, prev_node if inversed
|
160
|
+
rel.start_node_id = prev_node.id
|
161
|
+
rel.end_node_id = node.id
|
162
|
+
end
|
163
|
+
|
164
|
+
def ensure_correct_struct_size(type_constructor, expected, actual)
|
165
|
+
if expected != actual
|
166
|
+
struct_name = type_constructor.to_s
|
167
|
+
raise Neo4j::Driver::Exceptions::ClientException, "Invalid message received, serialized #{struct_name} structures should have #{expected} fields, received #{struct_name} structure has #{actual} fields."
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
private
|
172
|
+
|
173
|
+
def ensure_correct_struct_signature(struct_name, expected, actual)
|
174
|
+
if expected != actual
|
175
|
+
struct_name = type_constructor.to_s
|
176
|
+
raise Neo4j::Driver::Exceptions::ClientException, "Invalid message received, expected a `#{struct_name}`, signature 0x#{expected.to_i.to_s(16)}. Received signature was 0x#{actual.to_i.to_s(16)}."
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
def unpack_date
|
181
|
+
EPOCH + unpack
|
182
|
+
end
|
183
|
+
|
184
|
+
def time(nano_of_day_local, offset_seconds = nil)
|
185
|
+
min, sec = Rational(nano_of_day_local, NANO_FACTOR).divmod(60)
|
186
|
+
Time.new(0, 1, 1, *min.divmod(60), sec, offset_seconds)
|
187
|
+
end
|
188
|
+
|
189
|
+
def unpack_time
|
190
|
+
Types::OffsetTime.new(time(unpack, unpack))
|
191
|
+
end
|
192
|
+
|
193
|
+
def unpack_local_time
|
194
|
+
Types::LocalTime.new(time(unpack))
|
195
|
+
end
|
196
|
+
|
197
|
+
def unpack_local_date_time
|
198
|
+
Types::LocalDateTime.new(Time.at(unpack, unpack, :nsec).utc)
|
199
|
+
end
|
200
|
+
|
201
|
+
def unpack_date_time_with_zone_offset
|
202
|
+
# Time.at(unpack, unpack, :nsec, in: unpack)
|
203
|
+
sec = unpack
|
204
|
+
nsec = unpack
|
205
|
+
offset = unpack
|
206
|
+
time = Time.at(sec, nsec, :nsec).utc
|
207
|
+
Time.new(time.year, time.month, time.mday, time.hour, time.min, time.sec + Rational(nsec, 1_000_000_000),
|
208
|
+
offset)
|
209
|
+
end
|
210
|
+
|
211
|
+
def unpack_date_time_with_zone_id
|
212
|
+
time = Time.at(unpack, unpack, :nsec).in_time_zone(TZInfo::Timezone.get(unpack))
|
213
|
+
time - time.utc_offset
|
214
|
+
end
|
215
|
+
|
216
|
+
def unpack_duration
|
217
|
+
ActiveSupport::Duration.months(unpack) +
|
218
|
+
ActiveSupport::Duration.days(unpack) +
|
219
|
+
ActiveSupport::Duration.seconds(unpack) +
|
220
|
+
ActiveSupport::Duration.seconds(unpack * BigDecimal('1e-9'))
|
221
|
+
end
|
222
|
+
|
223
|
+
def unpack_point2_d
|
224
|
+
Types::Point.new(srid: unpack, x: unpack, y: unpack)
|
225
|
+
end
|
226
|
+
|
227
|
+
def unpack_point3_d
|
228
|
+
Types::Point.new(srid: unpack, x: unpack, y: unpack, z: unpack)
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Messaging
|
4
|
+
module Encode
|
5
|
+
class BeginMessageEncoder
|
6
|
+
def encode(message, packer)
|
7
|
+
Util::Preconditions.check_argument(message, Request::BeginMessage)
|
8
|
+
packer.pack_struct_header(1, message.signature)
|
9
|
+
packer.pack(message.metadata)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Messaging
|
4
|
+
module Encode
|
5
|
+
class CommitMessageEncoder
|
6
|
+
def encode(message, packer)
|
7
|
+
Util::Preconditions.check_argument(message, Request::CommitMessage)
|
8
|
+
packer.pack_struct_header(0, Request::CommitMessage::SIGNATURE)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Messaging
|
4
|
+
module Encode
|
5
|
+
class DiscardAllMessageEncoder
|
6
|
+
def encode(message, packer)
|
7
|
+
Util::Preconditions.check_argument(message, Request::DiscardAllMessage)
|
8
|
+
packer.pack_struct_header(0, Request::DiscardAllMessage::SIGNATURE)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Messaging
|
4
|
+
module Encode
|
5
|
+
class DiscardMessageEncoder
|
6
|
+
def encode(message, packer)
|
7
|
+
Util::Preconditions.check_argument(message, Request::DiscardMessage)
|
8
|
+
packer.pack_struct_header(1, Request::DiscardMessage::SIGNATURE)
|
9
|
+
packer.pack(message.metadata)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Messaging
|
4
|
+
module Encode
|
5
|
+
class GoodbyeMessageEncoder
|
6
|
+
def encode(message, packer)
|
7
|
+
Util::Preconditions.check_argument(message, Request::GoodbyeMessage)
|
8
|
+
packer.pack_struct_header(0, Request::GoodbyeMessage::SIGNATURE)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Messaging
|
4
|
+
module Encode
|
5
|
+
class HelloMessageEncoder
|
6
|
+
def encode(message, packer)
|
7
|
+
Util::Preconditions.check_argument(message, Request::HelloMessage)
|
8
|
+
packer.pack_struct_header(1, message.class::SIGNATURE)
|
9
|
+
packer.pack(message.metadata)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Messaging
|
4
|
+
module Encode
|
5
|
+
class InitMessageEncoder
|
6
|
+
def encode(message, packer)
|
7
|
+
Util::Preconditions.check_argument(message, Request::InitMessage)
|
8
|
+
packer.pack_struct_header(2, message.signature)
|
9
|
+
packer.pack(message.user_agent)
|
10
|
+
packer.pack(message.auth_token)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Messaging
|
4
|
+
module Encode
|
5
|
+
class PullAllMessageEncoder
|
6
|
+
def encode(message, packer)
|
7
|
+
Util::Preconditions.check_argument(message, Request::PullAllMessage)
|
8
|
+
packer.pack_struct_header(0, Request::PullAllMessage::SIGNATURE)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Messaging
|
4
|
+
module Encode
|
5
|
+
class PullMessageEncoder
|
6
|
+
def encode(message, packer)
|
7
|
+
Util::Preconditions.check_argument(message, Request::PullMessage)
|
8
|
+
packer.pack_struct_header(1, Request::PullMessage::SIGNATURE)
|
9
|
+
packer.pack(message.metadata)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Messaging
|
4
|
+
module Encode
|
5
|
+
class ResetMessageEncoder
|
6
|
+
def encode(message, packer)
|
7
|
+
Util::Preconditions.check_argument(message, Request::ResetMessage)
|
8
|
+
packer.pack_struct_header(0, Request::ResetMessage::SIGNATURE)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Messaging
|
4
|
+
module Encode
|
5
|
+
class RollbackMessageEncoder
|
6
|
+
def encode(message, packer)
|
7
|
+
Util::Preconditions.check_argument(message, Request::RollbackMessage)
|
8
|
+
packer.pack_struct_header(0, Request::RollbackMessage::SIGNATURE)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Messaging
|
4
|
+
module Encode
|
5
|
+
# Encodes the ROUTE message to the stream
|
6
|
+
class RouteMessageEncoder
|
7
|
+
def encode(message, packer)
|
8
|
+
Util::Preconditions.check_argument(message, Request::RouteMessage)
|
9
|
+
packer.pack_struct_header(3, message.signature)
|
10
|
+
packer.pack(message.routing_context)
|
11
|
+
packer.pack(message.bookmark.present? ? Values.value(message.bookmark.values) : Values.value(java.util.Collections.empty_list))
|
12
|
+
packer.pack(message.database_name)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Messaging
|
4
|
+
module Encode
|
5
|
+
# Encodes the ROUTE message to the stream
|
6
|
+
class RouteV44MessageEncoder
|
7
|
+
def encode(message, packer)
|
8
|
+
Util::Preconditions.check_argument(message, Request::RouteMessage)
|
9
|
+
packer.pack_struct_header(3, message.signature)
|
10
|
+
packer.pack(message.routing_context)
|
11
|
+
packer.pack(message.bookmark.present? ? Values.value(message.bookmark.values) : Values.value(java.util.Collections.empty_list))
|
12
|
+
|
13
|
+
if !message.impersonated_user.nil? && message.database_name.nil?
|
14
|
+
params = java.util.Collections.singleton_map("imp_user", Values.value(message.impersonated_user))
|
15
|
+
elsif !message.database_name.nil?
|
16
|
+
params = java.util.Collections.singleton_map("db", Values.value(message.database_name))
|
17
|
+
else
|
18
|
+
params = java.util.Collections.empty_map
|
19
|
+
end
|
20
|
+
|
21
|
+
packer.pack(params)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Messaging
|
4
|
+
module Encode
|
5
|
+
class RunMessageEncoder
|
6
|
+
def encode(message, packer)
|
7
|
+
Util::Preconditions.check_argument(message, Request::RunMessage)
|
8
|
+
packer.pack_struct_header(2, message.signature)
|
9
|
+
packer.pack(message.query)
|
10
|
+
packer.pack(message.parameters)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Messaging
|
4
|
+
module Encode
|
5
|
+
class RunWithMetadataMessageEncoder
|
6
|
+
def encode(message, packer)
|
7
|
+
Util::Preconditions.check_argument(message, Request::RunWithMetadataMessage)
|
8
|
+
packer.pack_struct_header(3, message.signature)
|
9
|
+
packer.pack(message.query)
|
10
|
+
packer.pack(message.parameters)
|
11
|
+
packer.pack(message.metadata)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Messaging
|
4
|
+
module Request
|
5
|
+
class AbstractStreamingMessage < Struct.new(:n, :qid)
|
6
|
+
STREAM_LIMIT_UNLIMITED = -1
|
7
|
+
alias metadata to_h
|
8
|
+
|
9
|
+
def to_s
|
10
|
+
"#{name} #{metadata}"
|
11
|
+
end
|
12
|
+
|
13
|
+
protected
|
14
|
+
|
15
|
+
def name
|
16
|
+
raise 'Abstract method called'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Messaging
|
4
|
+
module Request
|
5
|
+
class BeginMessage < MessageWithMetadata
|
6
|
+
SIGNATURE = 0x11
|
7
|
+
|
8
|
+
def initialize(bookmark, config, database_name, mode, impersonated_user)
|
9
|
+
super(Request::TransactionMetadataBuilder.build_metadata(
|
10
|
+
tx_timeout: config[:timeout]&.then(&DurationNormalizer.method(:milliseconds)),
|
11
|
+
tx_metadata: config[:metadata], database_name: database_name, mode: mode, bookmark: bookmark,
|
12
|
+
impersonated_user: impersonated_user))
|
13
|
+
end
|
14
|
+
|
15
|
+
def signature
|
16
|
+
SIGNATURE
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_s
|
20
|
+
"BEGIN #{metadata}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Neo4j::Driver
|
2
|
+
module Internal
|
3
|
+
module Messaging
|
4
|
+
module Request
|
5
|
+
class DiscardAllMessage
|
6
|
+
SIGNATURE = 0x2F
|
7
|
+
DISCARD_ALL = new
|
8
|
+
|
9
|
+
def signature
|
10
|
+
SIGNATURE
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_s
|
14
|
+
"DISCARD_ALL"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|