Neodriver_eio.TransportEio-based TCP transport with Bolt message framing.
Eio-based TCP transport with Bolt message framing.
See transport.ml for the implementation.
A TCP transport with bounded read and write timeouts, a TCP keep-alive flag and Bolt chunk framing.
val id : t -> intThe connection id of this transport (rendered as "#XXXX" in log lines; see Log.conn).
val keep_alive : t -> boolWhether TCP keep-alive (SO_KEEPALIVE) is enabled on the connection's socket.
val set_read_timeout : t -> Eio.Time.Timeout.t -> unitReplace the timeout bounding reads on the connection. The server advertises a receive timeout through the connection.recv_timeout_seconds HELLO hint, overriding the driver-configured default for that connection.
val set_write_timeout : t -> Eio.Time.Timeout.t -> unitReplace the timeout bounding writes on the connection.
type tls_mode = | Plain| Secure of Tls_client.configHow the connection is secured with TLS:
Plain: no TLS.Secure config: wrap the connection in TLS with config's trust anchors and host (system trust store for bolt+s, trust-all for bolt+ssc, or explicit custom certificates).val connect :
[> `Network | `Platform of [> `Generic ] ] Eio.Resource.t ->
Eio.Switch.t ->
?timeout:Eio.Time.Timeout.t ->
?write_timeout:Eio.Time.Timeout.t ->
?keep_alive:bool ->
?tls:tls_mode ->
Neodriver_core.Addressing.t ->
(t, Neodriver_core.Errors.t) Stdlib.resultOpen a TCP connection to address (resolving host names as needed) and return a transport. Each resolved address (IPv4 and IPv6) is tried in turn until one connects. If tls is Secure _, the connection is wrapped in TLS before returning. keep_alive (default true) sets the SO_KEEPALIVE socket option on the TCP socket (before any TLS wrap); a failure to set it is treated like a connection failure for that address. The TCP connect and TLS handshake share a single timeout deadline; reads on the result are bounded by timeout and writes by write_timeout. The defaults (Eio.Time.Timeout.none) impose no deadline.
val read_exact :
t ->
Stdlib.Bytes.t ->
int ->
int ->
(unit, Neodriver_core.Errors.t) Stdlib.resultRead exactly len bytes into buf starting at offset off.
val write :
t ->
Stdlib.Bytes.t ->
(unit, Neodriver_core.Errors.t) Stdlib.resultWrite buf to the connection.
val write_message :
t ->
Stdlib.Bytes.t ->
(unit, Neodriver_core.Errors.t) Stdlib.resultWrite a Bolt message, splitting it into 16 KiB chunks prefixed by their size and terminated by a 0x0000 chunk.
val read_message : t -> (Stdlib.Bytes.t, Neodriver_core.Errors.t) Stdlib.resultRead one Bolt message, reassembling its chunks and skipping NOOP (empty) messages.
val close : t -> unitClose the connection.