Expand description
Backend (server-to-client) messages.
This module parses messages sent from the Hyper server to the client.
Each message variant is discriminated by a single-byte tag; see the
*_TAG constants and the Message enum for the full catalog.
§Authentication Flow
The server initiates authentication with an Authentication* message.
Supported methods:
| Method | Tag subtype | Flow |
|---|---|---|
| Trust | R(0) | Server sends AuthenticationOk immediately |
| Cleartext | R(3) | Server requests password; client sends PasswordMessage |
| MD5 | R(5) + 4-byte salt | Client hashes md5(md5(password + user) + salt) |
| SCRAM-SHA-256 | R(10) | Multi-step challenge-response via SASLInitialResponse / SASLResponse |
After successful authentication the server sends AuthenticationOk,
followed by ParameterStatus messages, BackendKeyData, and finally
ReadyForQuery.
§Attribution
Portions of this module were adapted from
postgres-protocol’s
message/backend.rs (Copyright (c) 2016 Steven Fackler, MIT or
Apache-2.0). Adapted material includes the message-tag constants
(PARSE_COMPLETE_TAG = b'1', BIND_COMPLETE_TAG = b'2', …,
AUTHENTICATION_TAG = b'R', etc.), the Header struct shape, and
message-framing logic. Hyper-specific changes added on top include the
HyperBinary COPY format and Hyper-specific message variants. See the
NOTICE file at the repo root for the full upstream copyright and
reproduced license text.
Structs§
- Authentication
Md5Password Body - MD5 password authentication body.
- Authentication
Sasl Body - SASL authentication body.
- Authentication
Sasl Continue Body - SASL continue authentication body.
- Authentication
Sasl Final Body - SASL final authentication body.
- Backend
KeyData Body - Backend key data body.
- Command
Complete Body - Command complete body.
- Copy
Data Body - COPY data body.
- Copy
InResponse Body - COPY IN response body.
- Copy
OutResponse Body - COPY OUT response body.
- Data
RowBody - Data row body.
- Data
RowRanges - Iterator over data row column ranges.
- Error
Field - A single error or notice field.
- Error
Fields - Iterator over error fields in an
ErrorResponseorNoticeResponse. - Error
Response Body - Error response body.
- Field
- A field description in a
RowDescription. - Fields
- Iterator over field descriptions in a
RowDescription. - Header
- Message header information.
- Notice
Response Body - Notice response body (same format as error).
- Notification
Response Body - Notification response body.
- Parameter
Description Body - Parameter description body.
- Parameter
Status Body - Parameter status body.
- Parameters
- Iterator over parameter OIDs in a
ParameterDescription. - Ready
ForQuery Body - Ready for query body.
- RowDescription
Body - Row description body.
- Sasl
Mechanisms - Iterator over SASL mechanism names in an authentication message.
Enums§
- Message
- An enum representing backend messages from Hyper server.
Constants§
- AUTHENTICATION_
TAG - Message tag for Authentication (‘R’).
- BACKEND_
KEY_ DATA_ TAG - Message tag for
BackendKeyData(‘K’). - BIND_
COMPLETE_ TAG - Message tag for
BindComplete(‘2’). - CLOSE_
COMPLETE_ TAG - Message tag for
CloseComplete(‘3’). - COMMAND_
COMPLETE_ TAG - Message tag for
CommandComplete(‘C’). - COPY_
DATA_ TAG - Message tag for
CopyData(‘d’). - COPY_
DONE_ TAG - Message tag for
CopyDone(‘c’). - COPY_
IN_ RESPONSE_ TAG - Message tag for
CopyInResponse(‘G’). - COPY_
OUT_ RESPONSE_ TAG - Message tag for
CopyOutResponse(‘H’). - DATA_
ROW_ TAG - Message tag for
DataRow(‘D’). - EMPTY_
QUERY_ RESPONSE_ TAG - Message tag for
EmptyQueryResponse(‘I’). - ERROR_
RESPONSE_ TAG - Message tag for
ErrorResponse(‘E’). - NOTICE_
RESPONSE_ TAG - Message tag for
NoticeResponse(‘N’). - NOTIFICATION_
RESPONSE_ TAG - Message tag for
NotificationResponse(‘A’). - NO_
DATA_ TAG - Message tag for
NoData(‘n’). - PARAMETER_
DESCRIPTION_ TAG - Message tag for
ParameterDescription(‘t’). - PARAMETER_
STATUS_ TAG - Message tag for
ParameterStatus(‘S’). - PARSE_
COMPLETE_ TAG - Message tag for
ParseComplete(‘1’). - PORTAL_
SUSPENDED_ TAG - Message tag for
PortalSuspended(‘s’). - READY_
FOR_ QUERY_ TAG - Message tag for
ReadyForQuery(‘Z’). - ROW_
DESCRIPTION_ TAG - Message tag for
RowDescription(‘T’).