neo4j-ruby-driver 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +8 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +68 -0
  5. data/Rakefile +16 -0
  6. data/ffi/bolt/address.rb +11 -0
  7. data/ffi/bolt/auth.rb +10 -0
  8. data/ffi/bolt/auto_releasable.rb +22 -0
  9. data/ffi/bolt/boolean.rb +9 -0
  10. data/ffi/bolt/bytes.rb +10 -0
  11. data/ffi/bolt/config.rb +10 -0
  12. data/ffi/bolt/connection.rb +44 -0
  13. data/ffi/bolt/connector.rb +17 -0
  14. data/ffi/bolt/dictionary.rb +15 -0
  15. data/ffi/bolt/error.rb +74 -0
  16. data/ffi/bolt/float.rb +9 -0
  17. data/ffi/bolt/integer.rb +9 -0
  18. data/ffi/bolt/library.rb +12 -0
  19. data/ffi/bolt/lifecycle.rb +9 -0
  20. data/ffi/bolt/list.rb +10 -0
  21. data/ffi/bolt/status.rb +15 -0
  22. data/ffi/bolt/string.rb +9 -0
  23. data/ffi/bolt/structure.rb +10 -0
  24. data/ffi/bolt/value.rb +35 -0
  25. data/ffi/bolt/values_private.rb +36 -0
  26. data/ffi/neo4j/driver.rb +45 -0
  27. data/ffi/neo4j/driver/access_mode.rb +10 -0
  28. data/ffi/neo4j/driver/auth_tokens.rb +17 -0
  29. data/ffi/neo4j/driver/config.rb +11 -0
  30. data/ffi/neo4j/driver/graph_database.rb +29 -0
  31. data/ffi/neo4j/driver/internal/async/access_mode_connection.rb +19 -0
  32. data/ffi/neo4j/driver/internal/async/direct_connection.rb +88 -0
  33. data/ffi/neo4j/driver/internal/bookmarks_holder.rb +30 -0
  34. data/ffi/neo4j/driver/internal/direct_connection_provider.rb +27 -0
  35. data/ffi/neo4j/driver/internal/driver_factory.rb +38 -0
  36. data/ffi/neo4j/driver/internal/error_handling.rb +50 -0
  37. data/ffi/neo4j/driver/internal/explicit_transaction.rb +144 -0
  38. data/ffi/neo4j/driver/internal/handlers/pull_all_response_handler.rb +101 -0
  39. data/ffi/neo4j/driver/internal/handlers/response_handler.rb +46 -0
  40. data/ffi/neo4j/driver/internal/handlers/run_response_handler.rb +32 -0
  41. data/ffi/neo4j/driver/internal/handlers/session_pull_all_response_handler.rb +32 -0
  42. data/ffi/neo4j/driver/internal/handlers/transaction_pull_all_response_handler.rb +23 -0
  43. data/ffi/neo4j/driver/internal/internal_driver.rb +41 -0
  44. data/ffi/neo4j/driver/internal/internal_record.rb +22 -0
  45. data/ffi/neo4j/driver/internal/internal_statement_result.rb +52 -0
  46. data/ffi/neo4j/driver/internal/messaging/bolt_protocol.rb +24 -0
  47. data/ffi/neo4j/driver/internal/messaging/v1/bolt_protocol_v1.rb +59 -0
  48. data/ffi/neo4j/driver/internal/messaging/v2/bolt_protocol_v2.rb +16 -0
  49. data/ffi/neo4j/driver/internal/messaging/v3/bolt_protocol_v3.rb +63 -0
  50. data/ffi/neo4j/driver/internal/network_session.rb +124 -0
  51. data/ffi/neo4j/driver/internal/session_factory_impl.rb +28 -0
  52. data/ffi/neo4j/driver/internal/summary/internal_result_summary.rb +67 -0
  53. data/ffi/neo4j/driver/internal/summary/internal_server_info.rb +19 -0
  54. data/ffi/neo4j/driver/internal/summary/internal_summary_counters.rb +23 -0
  55. data/ffi/neo4j/driver/internal/util/metadata_extractor.rb +15 -0
  56. data/ffi/neo4j/driver/internal/value/base_time_value.rb +22 -0
  57. data/ffi/neo4j/driver/internal/value/date_value.rb +25 -0
  58. data/ffi/neo4j/driver/internal/value/duration_value.rb +27 -0
  59. data/ffi/neo4j/driver/internal/value/local_date_time_value.rb +24 -0
  60. data/ffi/neo4j/driver/internal/value/local_time_value.rb +19 -0
  61. data/ffi/neo4j/driver/internal/value/node_value.rb +18 -0
  62. data/ffi/neo4j/driver/internal/value/offset_time_value.rb +25 -0
  63. data/ffi/neo4j/driver/internal/value/path_value.rb +41 -0
  64. data/ffi/neo4j/driver/internal/value/point2_d_value.rb +24 -0
  65. data/ffi/neo4j/driver/internal/value/point3_d_value.rb +24 -0
  66. data/ffi/neo4j/driver/internal/value/relationship_value.rb +18 -0
  67. data/ffi/neo4j/driver/internal/value/structure_value.rb +42 -0
  68. data/ffi/neo4j/driver/internal/value/time_with_zone_id_value.rb +25 -0
  69. data/ffi/neo4j/driver/internal/value/time_with_zone_offset_value.rb +28 -0
  70. data/ffi/neo4j/driver/internal/value/unbound_relationship_value.rb +18 -0
  71. data/ffi/neo4j/driver/internal/value/value_adapter.rb +95 -0
  72. data/ffi/neo4j/driver/statement.rb +14 -0
  73. data/ffi/neo4j/driver/summary/statement_type.rb +14 -0
  74. data/ffi/neo4j/driver/types/entity.rb +17 -0
  75. data/ffi/neo4j/driver/types/node.rb +16 -0
  76. data/ffi/neo4j/driver/types/path.rb +35 -0
  77. data/ffi/neo4j/driver/types/relationship.rb +19 -0
  78. data/lib/loader.rb +18 -0
  79. data/lib/neo4j/driver/auto_closable.rb +32 -0
  80. data/lib/neo4j/driver/exceptions/authentication_exception.rb +10 -0
  81. data/lib/neo4j/driver/exceptions/client_exception.rb +10 -0
  82. data/lib/neo4j/driver/exceptions/database_exception.rb +10 -0
  83. data/lib/neo4j/driver/exceptions/illegal_state_exception.rb +10 -0
  84. data/lib/neo4j/driver/exceptions/neo4j_exception.rb +18 -0
  85. data/lib/neo4j/driver/exceptions/no_such_record_exception.rb +33 -0
  86. data/lib/neo4j/driver/exceptions/protocol_exception.rb +10 -0
  87. data/lib/neo4j/driver/exceptions/security_exception.rb +10 -0
  88. data/lib/neo4j/driver/exceptions/service_unavailable_exception.rb +10 -0
  89. data/lib/neo4j/driver/exceptions/session_expired_exception.rb +10 -0
  90. data/lib/neo4j/driver/exceptions/transient_exception.rb +10 -0
  91. data/lib/neo4j/driver/exceptions/untrusted_server_exception.rb +10 -0
  92. data/lib/neo4j/driver/internal/duration_normalizer.rb +42 -0
  93. data/lib/neo4j/driver/internal/ruby_signature.rb +18 -0
  94. data/lib/neo4j/driver/types/byte_array.rb +17 -0
  95. data/lib/neo4j/driver/types/local_date_time.rb +20 -0
  96. data/lib/neo4j/driver/types/local_time.rb +19 -0
  97. data/lib/neo4j/driver/types/offset_time.rb +19 -0
  98. data/lib/neo4j/driver/types/point.rb +39 -0
  99. data/lib/neo4j/driver/types/time.rb +43 -0
  100. data/lib/neo4j/driver/version.rb +7 -0
  101. data/lib/neo4j_ruby_driver.rb +19 -0
  102. data/neo4j-ruby-driver.gemspec +63 -0
  103. metadata +274 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 20187e624cb8b3b41c311fa3212d0464f326fd382b463a77c1943087667de719
4
+ data.tar.gz: 14dd13179266b82ffdca7ca880580d533d7f703fc85693486d5368f5a2db76ed
5
+ SHA512:
6
+ metadata.gz: 601176c163751a2dfd9ccec38d6f266ba731533e142c138e7e77f5947dd4d27e4bc0c5ff63ec6db09070cf45fa5a590c1bed330dd8f4305a872577d40e804e46
7
+ data.tar.gz: 1ba727e6f43f9933eda745a48dc0d334f90b9544bf17db9b9729f0e3ee7fa4d2beea7650e61e04ba95c1aed48819f176924de599a79d28e7188e1579b045963c
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in neo4j-driver.gemspec
8
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Heinrich Klobuczek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,68 @@
1
+ # Neo4j::Driver
2
+
3
+ Proposal for an API for neo4j ruby driver. This gem contains reference implementation in jruby with most of the features
4
+ completed.
5
+ The proposed API is heavilly inspired but the java and javascipt driver. Please add comments and suggestions if you feel there
6
+ is better idiomatic alternative in ruby.
7
+
8
+ The file `doc/dev_manual_examples_spec.rb` contains all the code examples included in the
9
+ [Chapter 4. Drivers][https://neo4j.com/docs/developer-manual/3.4/drivers/] of the Developer Manual and should be
10
+ reviewed side by side with that manual.
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'neo4j-ruby-driver'
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ $ bundle
23
+
24
+ Or install it yourself as:
25
+
26
+ $ gem install neo4j-ruby-driver
27
+
28
+ ## Usage
29
+
30
+ Refer to https://neo4j.com/docs/developer-manual/3.4/drivers/.
31
+
32
+ ## Development
33
+
34
+ After checking out the repo, run `bin/setup` to install dependencies.
35
+ In order to run test by running `rake spec` you may have to set your own `NEO4J_BOLT_URL` URI or it will
36
+ fallback to `bolt://localhost:7687`.
37
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment.
38
+
39
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
40
+
41
+ This gem includes 2 different implementations: java driver based and another one using seabolt via ffi
42
+
43
+ For java driver based:
44
+
45
+ $ rvm use jruby-9.2.5.0
46
+ $ bundle
47
+ $ rspec
48
+
49
+ FFI based:
50
+
51
+ $ rvm use 2.5.3 # or jruby-9.2.5.0
52
+ $ SEABOLT_LIB=~/seabolt/build/dist/lib/libseabolt17.dylib bundle
53
+ $ SEABOLT_LIB=~/seabolt/build/dist/lib/libseabolt17.dylib rspec
54
+
55
+ Please note that seabolt for now has to be installed separately: https://github.com/neo4j-drivers/seabolt
56
+
57
+ ## Contributing
58
+
59
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/neo4j-driver.
60
+
61
+ ## License
62
+
63
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
64
+
65
+
66
+ [https://neo4j.com/docs/developer-manual/3.4/drivers/]: https://neo4j.com/docs/developer-manual/3.4/drivers/
67
+
68
+ [https://neo4j.com/docs/developer-manual/3.4/drivers/]: https://neo4j.com/docs/developer-manual/3.4/drivers/
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+ require 'neo4j/rake_tasks'
6
+
7
+ if RUBY_PLATFORM.match?(/java/) && ENV['SEABOLT_LIB']&.length&.positive?
8
+ require 'jars/installer'
9
+ task :install_jars do
10
+ Jars::Installer.vendor_jars!('jruby')
11
+ end
12
+ end
13
+
14
+ RSpec::Core::RakeTask.new(:spec)
15
+
16
+ task default: :spec
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bolt
4
+ module Address
5
+ extend Bolt::Library
6
+ attach_function :create, :BoltAddress_create, %i[string string], :auto_pointer
7
+ attach_function :destroy, :BoltAddress_destroy, [:pointer], :void
8
+ attach_function :host, :BoltAddress_host, [:pointer], :strptr
9
+ attach_function :port, :BoltAddress_port, [:pointer], :strptr
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bolt
4
+ module Auth
5
+ extend Bolt::Library
6
+ attach_function :basic, :BoltAuth_basic, %i[string string string], :auto_pointer,
7
+ releaser: Bolt::Value.method(:destroy)
8
+ attach_function :none, :BoltAuth_none, [], :auto_pointer, releaser: Bolt::Value.method(:destroy)
9
+ end
10
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bolt
4
+ module AutoReleasable
5
+ def attach_function(name, func, args, returns = nil, options = nil)
6
+ return super unless returns == :auto_pointer
7
+
8
+ super(name, func, args, :pointer, options)
9
+ singleton_class.prepend with_auto_releaser(name, options&.dig(:releaser))
10
+ end
11
+
12
+ private
13
+
14
+ def with_auto_releaser(method, releaser)
15
+ Module.new do
16
+ define_method(method) do |*args|
17
+ FFI::AutoPointer.new(super(*args), releaser || self.method(:destroy))
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bolt
4
+ module Boolean
5
+ extend Bolt::Library
6
+
7
+ attach_function :get, :BoltBoolean_get, %i[pointer], :char
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bolt
4
+ module Bytes
5
+ extend Bolt::Library
6
+
7
+ attach_function :get, :BoltBytes_get, %i[pointer int32], :char
8
+ attach_function :get_all, :BoltBytes_get_all, %i[pointer], :pointer
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bolt
4
+ module Config
5
+ extend Bolt::Library
6
+ attach_function :create, :BoltConfig_create, [], :auto_pointer
7
+ attach_function :destroy, :BoltConfig_destroy, [:pointer], :void
8
+ attach_function :set_user_agent, :BoltConfig_set_user_agent, %i[pointer string], :int32
9
+ end
10
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bolt
4
+ module Connection
5
+ extend Bolt::Library
6
+
7
+ typedef :uint64, :bolt_request
8
+
9
+ attach_function :flush, :BoltConnection_send, [:pointer], :int32
10
+ attach_function :fetch, :BoltConnection_fetch, %i[pointer bolt_request], :int32
11
+ attach_function :fetch_summary, :BoltConnection_fetch_summary, %i[pointer bolt_request], :int32
12
+ attach_function :clear_begin, :BoltConnection_clear_begin, %i[pointer], :int32
13
+ attach_function :set_begin_bookmarks, :BoltConnection_set_begin_bookmarks, %i[pointer pointer], :int32
14
+ attach_function :set_begin_tx_timeout, :BoltConnection_set_begin_tx_timeout, %i[pointer int64], :int32
15
+ attach_function :set_begin_tx_metadata, :BoltConnection_set_begin_tx_metadata, %i[pointer pointer], :int32
16
+ attach_function :load_begin_request, :BoltConnection_load_begin_request, %i[pointer], :int32
17
+ attach_function :load_commit_request, :BoltConnection_load_commit_request, %i[pointer], :int32
18
+ attach_function :load_rollback_request, :BoltConnection_load_rollback_request, %i[pointer], :int32
19
+ attach_function :clear_run, :BoltConnection_clear_run, %i[pointer], :int32
20
+ attach_function :set_run_bookmarks, :BoltConnection_set_run_bookmarks, %i[pointer pointer], :int32
21
+ attach_function :set_run_tx_timeout, :BoltConnection_set_run_tx_timeout, %i[pointer int64], :int32
22
+ attach_function :set_run_tx_metadata, :BoltConnection_set_run_tx_metadata, %i[pointer pointer], :int32
23
+ attach_function :set_run_cypher, :BoltConnection_set_run_cypher, %i[pointer string uint64 int32], :int32
24
+ attach_function :set_run_cypher_parameter, :BoltConnection_set_run_cypher_parameter,
25
+ %i[pointer int32 string uint64], :pointer
26
+ attach_function :load_run_request, :BoltConnection_load_run_request, [:pointer], :int32
27
+ attach_function :load_discard_request, :BoltConnection_load_discard_request, %i[pointer int32], :int32
28
+ attach_function :load_pull_request, :BoltConnection_load_pull_request, %i[pointer int32], :int32
29
+ attach_function :load_reset_request, :BoltConnection_load_reset_request, [:pointer], :int32
30
+ attach_function :last_request, :BoltConnection_last_request, [:pointer], :bolt_request
31
+ attach_function :server, :BoltConnection_server, %i[pointer], :strptr
32
+ attach_function :id, :BoltConnection_id, %i[pointer], :strptr
33
+ attach_function :address, :BoltConnection_address, %i[pointer], :pointer
34
+ attach_function :remote_endpoint, :BoltConnection_remote_endpoint, %i[pointer], :pointer
35
+ attach_function :local_endpoint, :BoltConnection_local_endpoint, %i[pointer], :pointer
36
+ attach_function :last_bookmark, :BoltConnection_last_bookmark, %i[pointer], :strptr
37
+ attach_function :summary_success, :BoltConnection_summary_success, [:pointer], :int32
38
+ attach_function :failure, :BoltConnection_failure, [:pointer], :pointer
39
+ attach_function :field_names, :BoltConnection_field_names, [:pointer], :pointer
40
+ attach_function :field_values, :BoltConnection_field_values, [:pointer], :pointer
41
+ attach_function :metadata, :BoltConnection_metadata, %i[pointer], :pointer
42
+ attach_function :status, :BoltConnection_status, [:pointer], :pointer
43
+ end
44
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bolt
4
+ module Connector
5
+ extend Bolt::Library
6
+
7
+ BoltAccessMode = enum(
8
+ :bolt_access_mode_write,
9
+ :bolt_access_mode_read
10
+ )
11
+
12
+ attach_function :create, :BoltConnector_create, %i[pointer pointer pointer], :pointer
13
+ attach_function :destroy, :BoltConnector_destroy, [:pointer], :void
14
+ attach_function :acquire, :BoltConnector_acquire, [:pointer, BoltAccessMode, :pointer], :pointer
15
+ attach_function :release, :BoltConnector_release, %i[pointer pointer], :void
16
+ end
17
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bolt
4
+ module Dictionary
5
+ extend Bolt::Library
6
+
7
+ attach_function :key, :BoltDictionary_key, %i[pointer int32], :pointer
8
+ attach_function :get_key, :BoltDictionary_get_key, %i[pointer int32], :pointer
9
+ attach_function :get_key_size, :BoltDictionary_get_key_size, %i[pointer int32], :int32
10
+ attach_function :get_key_index, :BoltDictionary_get_key_index, %i[pointer string int32 int32], :int32
11
+ attach_function :set_key, :BoltDictionary_set_key, %i[pointer int32 string int32], :int32
12
+ attach_function :value, :BoltDictionary_value, %i[pointer int32], :pointer
13
+ attach_function :value_by_key, :BoltDictionary_value_by_key, %i[pointer string int32], :pointer
14
+ end
15
+ end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bolt
4
+ module Error
5
+ extend Bolt::Library
6
+
7
+ # Identifies a successful operation which is defined as 0
8
+ BOLT_SUCCESS = 0
9
+ # Unknown error
10
+ BOLT_UNKNOWN_ERROR = 1
11
+ # Unsupported protocol or address family
12
+ BOLT_UNSUPPORTED = 2
13
+ # Operation interrupted
14
+ BOLT_INTERRUPTED = 3
15
+ # Connection reset by peer
16
+ BOLT_CONNECTION_RESET = 4
17
+ # No valid resolved addresses found to connect
18
+ BOLT_NO_VALID_ADDRESS = 5
19
+ # Operation timed out
20
+ BOLT_TIMED_OUT = 6
21
+ # Permission denied
22
+ BOLT_PERMISSION_DENIED = 7
23
+ # Too may open files
24
+ BOLT_OUT_OF_FILES = 8
25
+ # Out of memory
26
+ BOLT_OUT_OF_MEMORY = 9
27
+ # Too many open ports
28
+ BOLT_OUT_OF_PORTS = 10
29
+ # Connection refused
30
+ BOLT_CONNECTION_REFUSED = 11
31
+ # Network unreachable
32
+ BOLT_NETWORK_UNREACHABLE = 12
33
+ # An unknown TLS error
34
+ BOLT_TLS_ERROR = 13
35
+ # Connection closed by remote peer
36
+ BOLT_END_OF_TRANSMISSION = 15
37
+ # Server returned a FAILURE message, more info available through \ref BoltConnection_failure
38
+ BOLT_SERVER_FAILURE = 16
39
+ # Unsupported bolt transport
40
+ BOLT_TRANSPORT_UNSUPPORTED = 0x400
41
+ # Unsupported protocol usage
42
+ BOLT_PROTOCOL_VIOLATION = 0x500
43
+ # Unsupported bolt type
44
+ BOLT_PROTOCOL_UNSUPPORTED_TYPE = 0x501
45
+ # Unknown pack stream type
46
+ BOLT_PROTOCOL_NOT_IMPLEMENTED_TYPE = 0x502
47
+ # Unexpected marker
48
+ BOLT_PROTOCOL_UNEXPECTED_MARKER = 0x503
49
+ # Unsupported bolt protocol version
50
+ BOLT_PROTOCOL_UNSUPPORTED = 0x504
51
+ # Connection pool is full
52
+ BOLT_POOL_FULL = 0x600
53
+ # Connection acquisition from the connection pool timed out
54
+ BOLT_POOL_ACQUISITION_TIMED_OUT = 0x601
55
+ # Address resolution failed
56
+ BOLT_ADDRESS_NOT_RESOLVED = 0x700
57
+ # Routing table retrieval failed
58
+ BOLT_ROUTING_UNABLE_TO_RETRIEVE_ROUTING_TABLE = 0x800
59
+ # No servers to select for the requested operation
60
+ BOLT_ROUTING_NO_SERVERS_TO_SELECT = 0x801
61
+ # Connection pool construction for server failed
62
+ BOLT_ROUTING_UNABLE_TO_CONSTRUCT_POOL_FOR_SERVER = 0x802
63
+ # Routing table refresh failed
64
+ BOLT_ROUTING_UNABLE_TO_REFRESH_ROUTING_TABLE = 0x803
65
+ # Invalid discovery response
66
+ BOLT_ROUTING_UNEXPECTED_DISCOVERY_RESPONSE = 0x804
67
+ # Error set in connection
68
+ BOLT_CONNECTION_HAS_MORE_INFO = 0xFFE
69
+ # Error set in connection
70
+ BOLT_STATUS_SET = 0xFFF
71
+
72
+ attach_function :get_string, :BoltError_get_string, [:int32], :string
73
+ end
74
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bolt
4
+ module Float
5
+ extend Bolt::Library
6
+
7
+ attach_function :get, :BoltFloat_get, %i[pointer], :double
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bolt
4
+ module Integer
5
+ extend Bolt::Library
6
+
7
+ attach_function :get, :BoltInteger_get, %i[pointer], :int64
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bolt
4
+ module Library
5
+ include FFI::Library
6
+ include Bolt::AutoReleasable
7
+
8
+ def self.extended(mod)
9
+ mod.ffi_lib ENV['SEABOLT_LIB']
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bolt
4
+ module Lifecycle
5
+ extend Bolt::Library
6
+ attach_function :startup, :Bolt_startup, [], :void
7
+ attach_function :shutdown, :Bolt_shutdown, [], :void
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bolt
4
+ module List
5
+ extend Bolt::Library
6
+
7
+ attach_function :resize, :BoltList_resize, %i[pointer int32], :void
8
+ attach_function :value, :BoltList_value, %i[pointer int32], :pointer
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bolt
4
+ module Status
5
+ extend Bolt::Library
6
+
7
+ typedef :int32, :bolt_connection_state
8
+
9
+ attach_function :create, :BoltStatus_create, [], :auto_pointer
10
+ attach_function :destroy, :BoltStatus_destroy, [:pointer], :void
11
+ attach_function :get_state, :BoltStatus_get_state, [:pointer], :bolt_connection_state
12
+ attach_function :get_error, :BoltStatus_get_error, [:pointer], :int32
13
+ attach_function :get_error_context, :BoltStatus_get_error_context, [:pointer], :string
14
+ end
15
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bolt
4
+ module String
5
+ extend Bolt::Library
6
+
7
+ attach_function :get, :BoltString_get, [:pointer], :pointer
8
+ end
9
+ end