Neodriver_eio.BoltBolt protocol messages (send/receive and response interpretation).
Bolt protocol messages: PackStream structures tagged by message type.
See bolt.ml for the implementation.
val send :
Transport.t ->
tag:int ->
Neodriver_packstream.Packstream.value list ->
(unit, Neodriver_core.Errors.t) Stdlib.resultPack a message with the given tag and fields and send it.
val recv :
Transport.t ->
(int * Neodriver_packstream.Packstream.value option, Neodriver_core.Errors.t)
Stdlib.resultRead one message and return its (tag, payload), where payload is the message's single field (none if the message carries no fields).
val recv_fields :
Transport.t ->
(int * Neodriver_packstream.Packstream.value list, Neodriver_core.Errors.t)
Stdlib.resultRead one message and return its (tag, fields). For a RECORD the fields are the record's values.
val respond :
Transport.t ->
(Neodriver_packstream.Packstream.value, Neodriver_core.Errors.t)
Stdlib.resultRead a response message and interpret it: SUCCESS metadata is returned as Ok _; a FAILURE is mapped to Error (Neo4j _) via its code and message; an IGNORED (or any other tag) is an error.
val hello :
Transport.t ->
headers:Neodriver_packstream.Packstream.value ->
(Neodriver_packstream.Packstream.value, Neodriver_core.Errors.t)
Stdlib.resultSend a HELLO message with headers and read the response.
val logon :
Transport.t ->
auth:Neodriver_packstream.Packstream.value ->
(Neodriver_packstream.Packstream.value, Neodriver_core.Errors.t)
Stdlib.resultSend a LOGON message with the authentication map auth and read the response.
val logoff :
Transport.t ->
(Neodriver_packstream.Packstream.value, Neodriver_core.Errors.t)
Stdlib.resultSend a LOGOFF message and read the response.
val run :
Transport.t ->
query:string ->
parameters:Neodriver_packstream.Packstream.value ->
extra:Neodriver_packstream.Packstream.value ->
(Neodriver_packstream.Packstream.value, Neodriver_core.Errors.t)
Stdlib.resultSend a RUN message for query with the given parameters and extra map, and read the response.
val begin_ :
Transport.t ->
extra:Neodriver_packstream.Packstream.value ->
(Neodriver_packstream.Packstream.value, Neodriver_core.Errors.t)
Stdlib.resultSend a BEGIN message with the extra map (mode, db, bookmarks, tx_metadata, tx_timeout) and read the response.
val commit :
Transport.t ->
(Neodriver_packstream.Packstream.value, Neodriver_core.Errors.t)
Stdlib.resultSend a COMMIT message and read the response (its metadata carries the bookmark).
val rollback :
Transport.t ->
(Neodriver_packstream.Packstream.value, Neodriver_core.Errors.t)
Stdlib.resultSend a ROLLBACK message and read the response.
val goodbye : Transport.t -> (unit, Neodriver_core.Errors.t) Stdlib.resultSend a GOODBYE message (the client is closing the connection); no response is read.
val route :
Transport.t ->
routing_context:Neodriver_packstream.Packstream.value ->
bookmarks:Neodriver_packstream.Packstream.value ->
extra:Neodriver_packstream.Packstream.value ->
(Neodriver_packstream.Packstream.value, Neodriver_core.Errors.t)
Stdlib.resultSend a ROUTE message (Bolt 4.3+): the routing table request for a database. routing_context is the URI routing context map, bookmarks the bookmark list and extra the database name (Bolt 4.3) or a db/imp_user map (Bolt 4.4+). The response metadata carries the rt routing table.
val pull :
?extra:Neodriver_packstream.Packstream.value ->
Transport.t ->
(Neodriver_packstream.Packstream.value list list
* (Neodriver_packstream.Packstream.value, Neodriver_core.Errors.t)
Stdlib.result,
Neodriver_core.Errors.t)
Stdlib.resultSend a PULL message and read the result: all RECORD messages up to the terminal message. extra carries the n/qid map on Bolt 4+; on Bolt 3 the PULL_ALL message takes no fields, so extra is omitted. Returns the records delivered so far and the terminal outcome — Ok summary on SUCCESS, Error _ on a server FAILURE/IGNORED (the records delivered before the failure are kept, so a mid-stream error can be surfaced after buffering).
val discard :
?extra:Neodriver_packstream.Packstream.value ->
Transport.t ->
(Neodriver_packstream.Packstream.value list list
* (Neodriver_packstream.Packstream.value, Neodriver_core.Errors.t)
Stdlib.result,
Neodriver_core.Errors.t)
Stdlib.resultSend a DISCARD message and read the result (same shape as pull, though records are normally empty). On Bolt 3 the DISCARD_ALL message takes no fields, so extra is omitted.
val metadata_has_more : Neodriver_packstream.Packstream.value -> boolWhether a summary metadata map carries has_more = true.
val collect_records :
Neodriver_packstream.Packstream.value list list ->
Transport.t ->
(Neodriver_packstream.Packstream.value list list
* (Neodriver_packstream.Packstream.value, Neodriver_core.Errors.t)
Stdlib.result,
Neodriver_core.Errors.t)
Stdlib.resultRead the RECORD messages of an already-sent PULL/DISCARD up to its summary: the records accumulated in acc (each record is its list of field values, in reverse order) plus the terminal outcome. Used when the request was sent without waiting for its response (e.g. a pipelined routing-procedure fetch).