Expand description
Low-level synchronous connection handling over the PostgreSQL wire protocol.
RawConnection provides the message-level interface to a Hyper server:
startup/authentication handshake, simple and extended query execution, and
the COPY data path. It is generic over the transport stream S (TCP,
Unix domain socket, named pipe, or TLS-wrapped variants).
§Wire Protocol Overview
Communication follows the PostgreSQL v3 message protocol. Each message has a
1-byte type tag, a 4-byte length (including itself), and a variable-length
body. The connection maintains separate read and write BytesMut buffers to
amortize syscall overhead.
§Query Protocols
-
Simple Query: A single
Query('Q')message; the server responds withRowDescription, zero or moreDataRow,CommandComplete, andReadyForQuery. Results are in text format. -
Extended Query (
HyperBinary):Parse/Bind/Describe/Execute/Syncsequence requesting format code 2 (HyperBinary, little-endian binary). Results are zero-copy-friendlyDataRowmessages. Used byClient::query_fastandClient::query_streaming.
§Connection Health
A desynchronized flag tracks whether the wire protocol has fallen out of
sync (e.g., a bounded drain exceeded its budget). Once set, all subsequent
operations fast-fail. The only recovery is to drop the connection and
open a new one. Pool layers should check RawConnection::is_healthy
during recycle.
Structs§
- RawConnection
- A raw connection to a Hyper server.
Constants§
- POST_
ERROR_ DRAIN_ CAP - Maximum number of messages
RawConnection::consume_error(and its async sibling) will read while draining the tail of a failed request.