Module: Neo4j::Driver::Bolt::Message
- Defined in:
- lib/neo4j/driver/bolt/message.rb,
lib/neo4j/driver/bolt/message/record.rb,
lib/neo4j/driver/bolt/message/failure.rb,
lib/neo4j/driver/bolt/message/ignored.rb,
lib/neo4j/driver/bolt/message/success.rb
Overview
Bolt Protocol Messages
Defined Under Namespace
Classes: Failure, Ignored, Record, Success
Constant Summary collapse
- HELLO =
Request messages (sent from client to server)
0x01- GOODBYE =
0x02- RESET =
0x0F- RUN =
0x10- BEGIN_TX =
0x11- COMMIT =
0x12- ROLLBACK =
0x13- PULL =
0x3F- DISCARD =
0x2F- ROUTE =
0x66- LOGON =
0x6A- LOGOFF =
0x6B- TELEMETRY =
0x54- SUCCESS =
Response messages (sent from server to client)
0x70- RECORD =
0x71- IGNORED =
0x7E- FAILURE =
0x7F
Class Method Summary collapse
- .begin_transaction(extra = {}) ⇒ Object
- .commit ⇒ Object
- .discard(extra = {}) ⇒ Object
- .goodbye ⇒ Object
-
.hello(user_agent:, auth:, routing: nil) ⇒ Object
NOTE: HELLO message building is now handled by protocol-specific handlers This method kept for backward compatibility but shouldn't be used directly.
-
.logoff ⇒ Object
LOGOFF (Bolt 5.1+).
-
.logon(auth) ⇒ Object
LOGON (Bolt 5.1+).
-
.pull(extra = {}) ⇒ Object
Caller must specify n explicitly — Java/Python default is 1000 records per batch but the call site (Session/Transaction) knows the configured fetch_size and passes it through.
- .reset ⇒ Object
- .rollback ⇒ Object
-
.route(routing_context, bookmarks, extra) ⇒ Object
ROUTE (Bolt 4.3+) — fetch the cluster's routing table.
- .run(query, parameters = {}, extra = {}) ⇒ Object
-
.telemetry(api) ⇒ Object
Bolt 5.4+ TELEMETRY: reports which driver API opened the coming transaction/query (0 tx-function, 1 unmanaged tx, 2 auto-commit, 3 execute_query).
Class Method Details
.begin_transaction(extra = {}) ⇒ Object
44 45 46 |
# File 'lib/neo4j/driver/bolt/message.rb', line 44 def begin_transaction(extra = {}) PackStream::Structure.new(BEGIN_TX, [extra]) end |
.commit ⇒ Object
48 49 50 |
# File 'lib/neo4j/driver/bolt/message.rb', line 48 def commit PackStream::Structure.new(COMMIT, []) end |
.discard(extra = {}) ⇒ Object
64 65 66 67 |
# File 'lib/neo4j/driver/bolt/message.rb', line 64 def discard(extra = {}) extra = { n: -1 }.merge(extra) PackStream::Structure.new(DISCARD, [extra]) end |
.goodbye ⇒ Object
81 82 83 |
# File 'lib/neo4j/driver/bolt/message.rb', line 81 def goodbye PackStream::Structure.new(GOODBYE, []) end |
.hello(user_agent:, auth:, routing: nil) ⇒ Object
NOTE: HELLO message building is now handled by protocol-specific handlers This method kept for backward compatibility but shouldn't be used directly
32 33 34 35 36 37 38 |
# File 'lib/neo4j/driver/bolt/message.rb', line 32 def hello(user_agent:, auth:, routing: nil) extra = { user_agent: user_agent } extra[:routing] = routing if routing # Default to Bolt 5.0+ format (merged auth) extra.merge!(auth) if auth PackStream::Structure.new(HELLO, [extra]) end |
.logoff ⇒ Object
LOGOFF (Bolt 5.1+). De-authenticates the connection; the
next LOGON re-authenticates with a possibly-different
token. Used by per-session auth (driver.session(auth: …))
to switch identity on a pooled connection without tearing
it down.
97 98 99 |
# File 'lib/neo4j/driver/bolt/message.rb', line 97 def logoff PackStream::Structure.new(LOGOFF, []) end |
.logon(auth) ⇒ Object
LOGON (Bolt 5.1+). Carries the auth fields that 5.0 used to send inside HELLO. The server's success here marks the connection authenticated and READY.
88 89 90 |
# File 'lib/neo4j/driver/bolt/message.rb', line 88 def logon(auth) PackStream::Structure.new(LOGON, [auth || {}]) end |
.pull(extra = {}) ⇒ Object
Caller must specify n explicitly — Java/Python default is 1000 records per batch but the call site (Session/Transaction) knows the configured fetch_size and passes it through. Default-here would silently mask "forgot to plumb fetch_size".
60 61 62 |
# File 'lib/neo4j/driver/bolt/message.rb', line 60 def pull(extra = {}) PackStream::Structure.new(PULL, [extra]) end |
.reset ⇒ Object
77 78 79 |
# File 'lib/neo4j/driver/bolt/message.rb', line 77 def reset PackStream::Structure.new(RESET, []) end |
.rollback ⇒ Object
52 53 54 |
# File 'lib/neo4j/driver/bolt/message.rb', line 52 def rollback PackStream::Structure.new(ROLLBACK, []) end |
.route(routing_context, bookmarks, extra) ⇒ Object
ROUTE (Bolt 4.3+) — fetch the cluster's routing table.
routing_context : map (typically built from the URI query string)
bookmarks : list of bookmarks (or nil for Bolt 4.3 compat)
extra :
105 106 107 |
# File 'lib/neo4j/driver/bolt/message.rb', line 105 def route(routing_context, bookmarks, extra) PackStream::Structure.new(ROUTE, [routing_context, bookmarks, extra]) end |
.run(query, parameters = {}, extra = {}) ⇒ Object
40 41 42 |
# File 'lib/neo4j/driver/bolt/message.rb', line 40 def run(query, parameters = {}, extra = {}) PackStream::Structure.new(RUN, [query, parameters, extra]) end |
.telemetry(api) ⇒ Object
Bolt 5.4+ TELEMETRY: reports which driver API opened the coming
transaction/query (0 tx-function, 1 unmanaged tx, 2 auto-commit,
3 execute_query). Sent only when the server advertised
telemetry.enabled and the driver didn't disable it.
73 74 75 |
# File 'lib/neo4j/driver/bolt/message.rb', line 73 def telemetry(api) PackStream::Structure.new(TELEMETRY, [api]) end |